KK's Wiki krzysiek_kk http://devkk.net/wiki/index.php/Main_Page MediaWiki 1.24.0 first-letter Media Special Talk User User talk KK's Wiki KK's Wiki talk File File talk MediaWiki MediaWiki talk Template Template talk Help Help talk Category Category talk Adding custom assets 0 30 143 2021-09-07T21:56:27Z Krzysiek 1 Created page with " == Adding new flats == To add new available color combination to the ''PK3'' structure: # Open dread/textures-new.txt in text editor # Add desired flats into "gfxgroup Flats..." wikitext text/x-wiki == Adding new flats == To add new available color combination to the ''PK3'' structure: # Open dread/textures-new.txt in text editor # Add desired flats into "gfxgroup Flats" similarily as existing.<br/>e.g. "flat FOOBAR 2:3 1:2@128" means to add flat texture FOOBAR being a dithered mix of colors 2 and 3 in full ight, and colors 1 and 2 at light level 128. # In the tool switch to "Textures" tab and click "PK3" to rebuild the PK3 structure. # Close and reopen Doom Builder 2. # Your new flat should be available now. 82dfc0bef5d978c14ee1594ec794f5cf0b3037f2 Advanced mapping tricks 0 28 140 2021-09-07T20:00:44Z Krzysiek 1 Created page with " == Dread maps special tricks == === Faking variable sky height === You can force different walls of the same outdoor section to render with different heights. This can be u..." wikitext text/x-wiki == Dread maps special tricks == === Faking variable sky height === You can force different walls of the same outdoor section to render with different heights. This can be used to simulate e.g. large building on one side, surrounded with lower fences on the others. Variable height stacks of boxes are another example (warning: you won't be able to see above the boxes). There are two ways of doing that: # Fake sector - any sector with floor texture set to ''F_SKY1'' will be removed by the converter.<br/>If such sector has floor height equal to ''64'', ''96'' or ''128'', the outer lines of the removed sector will draw the lower texture up to the specified height. # Linedef action - set linedef action to ''104'' or ''106'' (''TX Front facade height ##px'') to force wall height to ''64'' or ''96'' units. === Implementing doors === ''TBD'' 6cb663e7051579fa182d48da7e703224d0ad74fe Alternate VCS definitions 0 19 67 2014-12-21T12:30:13Z Krzysiek 1 Created page with "[[Category:K65]] __FORCETOC__ File '''_defs.k65''' provides alternate definitions of Atari 2600 registers. While use of this file is not required (standard VCS register names..." wikitext text/x-wiki [[Category:K65]] __FORCETOC__ File '''_defs.k65''' provides alternate definitions of Atari 2600 registers. While use of this file is not required (standard VCS register names are predefined), after initial learning it can speed up prototyping by using shorter and lowercase names for all registers which are shorter and easier to type. This file also provides basic frame handling definitions and works well as quick reference to VCS register functions and bit patterns. === VCS register aliases === '''_defs.k65''' provides following extra register alternative names. {| class="wikitable" ! colspan=4 | TIA registers (Write) |- ! Address ! Standard name ! Alternate name ! Description |- | 00h || VSYNC || - || Vertical sync set-clear |- | 01h || VBLANK || - || Vertical blank set-clear |- | 02h || WSYNC || - || Wait for leading edge of horizontal blank <strobe> |- | 03h || RSYNC || - || Reset horizontal sync counter <strobe> |- | 04h || NUSIZ0 || ns0 || Number-size player-missile 0 |- | 05h || NUSIZ1 || ns1 || Number-size player-missile 1 |- | 06h || COLUP0 || cp0 || Color Luminosity Player 0, Missile 0 |- | 07h || COLUP1 || cp1 || Color Luminosity Player 1, Missile 1 |- | 08h || COLUPF || cpf || Color Luminosity Playfield, Ball |- | 09h || COLUBK || cbg || Color Luminosity Background |- | 0Ah || CTRLPF || ctpf || Control Playfield and Ball size |- | 0Bh || REFP0 || rep0 || Reflect player 0 |- | 0Ch || REFP1 || rep1 || Reflect player 1 |- | 0Dh || PF0 || pf0 || Playfield Register 0 (LSB first) (only upper 4bit used) |- | 0Eh || PF1 || pf1 || Playfield Register 1 (MSB first) (8bit) |- | 0Fh || PF2 || pf2 || Playfield Register 2 (LSB first) (8bit) |- | 10h || RESP0 || rp0 || Reset player 0 <strobe> |- | 11h || RESP1 || rp1 || Reset player 1 <strobe> |- | 12h || RESM0 || rm0 || Reset missile 0 <strobe> |- | 13h || RESM1 || rm1 || Reset missile 1 <strobe> |- | 14h || RESBL || rb || Reset ball <strobe> |- | 15h || AUDC0 || ac0 || Audio Noise/Division Control, Channel 0 |- | 16h || AUDC1 || ac1 || Audio Noise/Division Control, Channel 1 |- | 17h || AUDF0 || af0 || Audio Frequency Divider, Channel 0 |- | 18h || AUDF1 || af1 || Audio Frequency Divider, Channel 1 |- | 19h || AUDV0 || av0 || Audio Volume, Channel 0 |- | 1Ah || AUDV1 || av1 || Audio Volume, Channel 1 |- | 1Bh || GRP0 || gp0 || Graphics (enable) player 0 |- | 1Ch || GRP1 || gp1 || Graphics (enable) player 1 |- | 1Dh || ENAM0 || em0 || Graphics (enable) missile 0 |- | 1Eh || ENAM1 || em1 || Graphics (enable) missile 1 |- | 1Fh || ENABL || eb || Graphics (enable) ball |- | 20h || HMP0 || hp0 || Horizontal motion player 0 |- | 21h || HMP1 || hp1 || Horizontal motion player 1 |- | 22h || HMM0 || hm0 || Horizontal motion missile 0 |- | 23h || HMM1 || hm1 || Horizontal motion missile 1 |- | 24h || HMBL || hb || Horizontal motion ball |- | 25h || VDELP0 || vdp0 || Vertical delay player 0 (Delay GRP0 until writing to GRP1) |- | 26h || VDELP1 || vdp1 || Vertical delay player 1 (Delay GRP1 until writing to GRP0) |- | 27h || VDELBL || vdb || Vertical delay ball (Delay ENABL until writing to GRP1) |- | 28h || RESMP0 || rmp0 || Reset missile 0 to player 0 |- | 29h || RESMP1 || rmp1 || Reset missile 1 to player 1 |- | 2Ah || HMOVE || hmove || Apply horizontal motion <strobe> |- | 2Bh || HMCLR || hmclr || Clear horizontal motion registers <strobe> |- | 2Ch || CXCLR (W) || - || Clear all collision latches <strobe> |- |} {| class="wikitable" ! colspan=4 | TIA registers (Read) |- ! Address ! Standard name ! Alternate name ! Description |- | 30h || CXM0P (R) || - || Collision Latch M0-P1, M0-P0 (Bit 7,6) |- | 31h || CXM1P (R) || - || Collision Latch M1-P0, M1-P1 (Bit 7,6) |- | 32h || CXP0FB (R) || - || Collision Latch P0-PF, P0-BL (Bit 7,6) |- | 33h || CXP1FB (R) || - || Collision Latch P1-PF, P1-BL (Bit 7,6) |- | 34h || CXM0FB (R) || - || Collision Latch M0-PF, M0-BL (Bit 7,6) |- | 35h || CXM1FB (R) || - || Collision Latch M1-PF, M1-BL (Bit 7,6) |- | 36h || CXBLPF (R) || - || Collision Latch BL-PF (Bit 7) |- | 37h || CXPPMM (R) || - || Collision Latch P0-P1, M0-M1 (Bit 7,6) |- |} {| class="wikitable" ! colspan=4 | PIA registers |- ! Address ! Standard name ! Alternate name ! Description |- | 280h || SWCHA || swcha || PIA Port A; input or output (R/W) |- | 281h || SWACNT || - || PIA Port A DDR Data Direction Register (R/W) |- | 282h || SWCHB || swchb || PIA Port B, Console Switches (R/W) (normally Read Only) |- | 283h || SWBCNT || - || PIA Port B DDR Data Direction Register (R/W) |- | 284h || INTIM || - || PIA Current Timer Value (Read only) |- | 285h || INSTAT || - || PIA Timer Status (Read only) (Undocumented) |- | 294h || TIM1T || - || PIA Set Timer & Select 1 clock interval (838ns/interval) |- | 295h || TIM8T || - || PIA Set Timer & Select 8 clock interval (6.7us/interval) |- | 296h || TIM64T || - || PIA Set Timer & Select 64 clock interval (53.6us/interval) |- | 297h || T1024T || - || PIA Set Timer & Select 1024 clock interval (858.2us/interval) |- |} === Special macros === '''_defs.k65''' provides following extra inline macros. {| class="wikitable" ! Macro name ! Description |- | &nbsp;&nbsp;init || Clears entire zero page (including TIA regs), sets stack to RAM top, disables interrupts and decimal mode |- | &nbsp;timwait || Waits until PIA timer is zero (used in ''sync#'' macros) |- | &nbsp;wsync || Waits for horizontal blanking (simply ''WSYNC=a'') |- | &nbsp;sync1 || Waits for timer and starts overscan (lower border) - you have approximately 45 scanlines (NTSC: 37) of overscan time after this. |- | &nbsp;sync2 || Waits for timer and pulses VSYNC and starts overscan (upper border) - you have approximately 36 scanlines (NTSC: 30) of overscan time after this. |- | &nbsp;sync3 || Waits for timer and visible screen portion - you have to generate approximately 228 scanlines (NTSC: 192) of visible picture now. |- |} === File source code === <source lang="c"> var zeropage = 0; // Type NTSC PAL/SECAM // V-Sync 3 3 scanlines // V-Blank 37 45 scanlines (upper border) // Picture 192 228 scanlines // Overscan 30 36 scanlines (lower border) // Frame Rate 60 50 Hz // Frame Time 262 312 scanlines // --- scanline numbers --- // Type NTSC PAL/SECAM // V-Sync 3 3 // V-Blank 37 45 // Picture 192 228 // Overscan 30 36 inline init { i+ d- s=x=0xFF a=0 { zeropage,x=a x-- }!= } inline timwait { { a=INTIM }!= } inline wsync { WSYNC=a } // PAL: 0 45 275 312 // NTSC: 0 37 231 262 // PAL inline sync1 { timwait wsync VBLANK=a=2 TIM64T=a=40 } inline sync2 { timwait wsync VSYNC=a=2 wsync wsync a=0 wsync VSYNC=a TIM64T=a=54 } inline sync3 { timwait wsync VBLANK=a=0 T1024T=a=18 } // NTSC //inline sync1 { timwait wsync VBLANK=a=2 TIM64T=a=33 } //inline sync2 { timwait wsync VSYNC=a=2 wsync wsync a=0 wsync VSYNC=a TIM64T=a=44 } //inline sync3 { timwait wsync VBLANK=a=0 TIM64T=a=231 } var ns0=0x04,ns1; // 00xx 0xxx Number-Size player/missle 0/1 // ^^^ - Player-Missile number & Player size (See table below) // 000 0 One copy (X.........) // 001 1 Two copies - close (X.X.......) // 010 2 Two copies - medium (X...X.....) // 011 3 Three copies - close (X.X.X.....) // 100 4 Two copies - wide (X.......X.) // 101 5 Double sized player (XX........) // 110 6 Three copies - medium (X...X...X.) // 111 7 Quad sized player (XXXX......) // ^^ - Missile Size (0..3 = 1,2,4,8 pixels width) var cp0=0x06,cp1,cpf,cbg; // xxxx xxx- Color-Luminance Player 0/1, Playfield, Background var ctpf=0x0A; // --xx -xxx Control Playfield, Ball, Collisions // ^ - Playfield Reflection (0=Normal, 1=Mirror right half) // ^ - Playfield Color (0=Normal, 1=Score Mode, only if Bit2=0) // ^ - Playfield/Ball Priority (0=Normal, 1=Above Players/Missiles) // ^^ - Ball size (0..3 = 1,2,4,8 pixels width) var rep0=0x0B, rep1; // ---- x--- Reflection Player 0/1 var pf0=0x0D, pf1, pf2; // xxxx ---- Playfield Register Byte 0 // xxxx xxxx Playfield Register Byte 1 // xxxx xxxx Playfield Register Byte 2 var rp0=0x10,rp1,rm0,rm1,rb; // ---- ---- Reset Player 0/1, Missile 0/1, Ball var gp0=0x1B,gp1; // xxxx xxxx Graphics Register Player 0/1 var em0=0x1D,em1,eb; // ---- --x- Graphics Enable Missle 0/1, Ball var hp0=0x20,hp1,hm0,hm1,hb; // xxxx ---- Horizontal Motion Player 0/1, Missile 0/1, Ball var vdp0=0x25,vdp1,vdb; // ---- ---x Vertical Delay Player 0/1, Ball var rmp0=0x28,rmp1; // ---- --x- Reset Missle 0/1 to Player 0/1 var hmove=0x2A; // ---- ---- Apply Horizontal Motion var hmclr=0x2B; // ---- ---- Clear Horizontal Move Registers var gp0h=0x11B,gp1h; // xxxx xxxx Graphics Register Player 0/1 var rmp0h=0x128,rmp1h; // ---- --x- Reset Missle 0/1 to Player 0/1 var pf0h=0x10D, pf1h, pf2h; // xxxx ---- Playfield Register Byte 0 var cp0h=0x106,cp1h,cpfh,cbgh; // xxxx xxx- Color-Luminance Player 0/1, Playfield, Background var hp0h=0x120,hp1h,hm0h,hm1h,hbh; // xxxx ---- Horizontal Motion Player 0/1, Missile 0/1, Ball var ac0=0x15,ac1; // ---- xxxx Audio Control 0/1 var af0=0x17,af1; // ---x xxxx Audio Frequency 0/1 var av0=0x19,av1; // ---- xxxx Audio Volume 0/1 var inpt0=0x38; // x--- ---- read pot port var inpt1=0x39; // x--- ---- read pot port var inpt2=0x3A; // x--- ---- read pot port var inpt3=0x3B; // x--- ---- read pot port var inpt4=0x3C; // x--- ---- read input / P0 Fire (0 active) var inpt5=0x3D; // x--- ---- read input / P1 Fire (0 active) var swcha=0x280; // xxxx xxxx Port A // ^ - P1 Up (0 active) // ^ - P1 Down (0 active) // ^ - P1 Left (0 active) // ^ - P1 Right (0 active) // ^ - P0 Up (0 active) // ^ - P0 Down (0 active) // ^ - P0 Left (0 active) // ^ - P0 Right (0 active) var swchb=0x282; // xx-- x-xx Port B // ^ - Reset Button (0=Pressed) // ^ - Select Button (0=Pressed) // ^ - Color Switch (0=B/W, 1=Color) (Always 0 for SECAM) // ^ - P0 Difficulty Switch (0=Beginner (B), 1=Advanced (A)) // ^ - P1 Difficulty Switch (0=Beginner (B), 1=Advanced (A)) </source> ac86bd042ab86faa6705a21989208ab5dc60a289 Assets.txt 0 23 131 130 2021-05-10T08:44:11Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''group'' ''Deprecated: alternatively 'gfxgroup' keyword can be used in place of the 'group' keyword.'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... group Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -ramp ''<index1> <index2> ...'' === Specifies a color ramp to be used for dithering. This option should be specified before any ''-weight'' option. The first occurrence of ''-ramp'' and disallows dithering from using any color pair except when such colors are consecutive colors in the ramp. Further ramps can enable additional color pairs. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode> [{ ... ]'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space (sRGB) * ''xyz'' - XYZ color space * ''yuv'' - YUV color space * ''lab'' - CIE Lab color space * ''badlab'' - old broken implementation of the CIE Lab color space, which sometimes gave better results The colorspace block accepts following options: * ''-weights'' * ''-gamma'' * ''-luma'' ==== -weights ''<w1> <w2> <w3> [<w4>]'' ==== This option specifies per-channel weights for each component of the selected color space ('''R/G/B, Y/U/V, X/Y/Z'' or ''L/a/b''). E.g. a weight equal ''0'' means that the component should be ignored, where ''1'' means the default contribution. Additionally, the ''RGB'' color space introduces an optional 4th component of luminance. ==== -gamma ''<gr> [<gg> <gb>]'' ==== ''( RGB colorspace only )'' Specifies gamma value (per-channel, optionally) of the color space. E.g. using gamma value between ''2.0'' and ''2.4'' should make the RGB color space more or less linear. ==== -luma ''<wr> <wg> <wb>'' ==== ''( RGB colorspace only )'' Specifies per-channel weights for color luminance estimation. The weights are automatically normalized internally. If luminance error weight was not set (e.g. no ''-weights'' option was specified), the luminance weight is now set to ''1.0''. === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. group NameOfMyAssetGroup { // place options, sub-groups and assets here } === group ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: group Objects { group Monsters { group Soldier { // place actual assets here } group AnotherMonster { // place actual assets here } } } ''Deprecated: alternatively 'gfxgroup' keyword can be used in place of the 'group' keyword.'' === gfx ''<name> [<xoff> <yoff>] [-file <name>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). If ''-file'' option is specified, a different file name is used for loading, and the first name is used only for asset referencing and export purposes. Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: group Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } Within the hidden group, you can specify overlay images using commands: * ''static <gfx> <x> <y>'' - overlays and merges another graphics asset (defined earlier in the file) * ''icon <gfx> <x> <y> <varname>'' - specifies icon that can be shown over the graphics (draws it in preview, at runtime this is engine dependent) * ''number <font> <x> <y> <step> <varname> <max>'' - specifies that a number should be printed (drawn in preview, engine dependent at runtime) ==== static ''<gfx> <x> <y>'' ==== This subcommand statically overlays another graphics on top of the current one during pixel processing. The ''<gfx>'' should specify the name of a previously loaded graphics. ''<x>'' and ''<y>'' specify drawing offsets. The drawing can take place anywhere in the target image rectangle and is clipped to these borders. ==== icon ''<gfx> <x> <y> <varname>'' ==== This subcommand signals that an icon can be drawn on top of the image. It causes the overlay to be drawn in the preview, but function is engine-dependent. The ''<gfx>'' should specify the name of a previously loaded graphics. ''<x>'' and ''<y>'' specify drawing offsets. ''<varname>'' is the name of the variable passed to the engine. Designed to specify drawing of key icons on the status bar. ==== number ''<font> <x> <y> <step> <varname> <max>'' ==== This subcommand signals that a number can be drawn on top of the image. It causes the number to be printed in the preview, but function is engine-dependent. The ''<font>'' should specify the name of a previously defined asset group containing all glyphs of the number font, in order. The last one is used in preview. ''<x>'' and ''<y>'' specify drawing offsets. ''<step>'' is the X offset between consecutive characters (the font is assumed to be monospaced). ''<varname>'' is the name of the variable passed to the engine. ''<max>'' is the maximum supported value and from this the tool derives how many digits are printed. Designed to specify drawing of key icons on the status bar. === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes, optionally followed by the mask * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''font_mask'' - export ALL graphics of this asset group as 1bpp font with special header containing font information * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask * ''chipmem'' - export to CHIP memory (Amiga only) ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === ==== Graphics processing sequence ==== The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Downscaling (''-downscale / -collapse / -lanczos'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') * HD packing (''-downscale HD / -lanczos pack / -pixelpack'') * Overlaying static graphics (''static'') * Trimming (''-trim'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse'' and ''-lanczos''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' and ''-lanczos'' - the latest specified option overrides previous ones. ==== -lanczos ''<x0> <y0> <xstep> [<ystep>] [blur <bx> [<by>]] [width <wx> [<wy>]] [pack]'' ==== Performs Lanczos downsampling of the image. This should allow quick asset prototyping by drawing the high resolution sketch of the art instead of pixeling it. The ''<x0>'' and ''<y0>'' specify the origin location coordinates on the high resolution image, which location after downscaling will be used as the final image origin. To produce downscaled image, the high resolution image is sampled in a grid pattern (each grid point produces one pixel of the final image). Samples are taken with steps specified by ''<xstep>'' and ''<ystep>'' (if the latter is missing, the grid is uniform). The sampling area is not specified directly and covers entire source image. The grid step values must be integer - fractional scaling is not supported now. For best results, the Lanczos filter blurs the image with blur size equal to the grid step. This can be overridden by specifying ''blur <bx> <by>'' option, which provides the blur size in both directions (specifying only one makes the blur uniform). Blur size is specified in pixels of the high resolution (source) image. Fractional blur sizes are supported. Specifying ''blur 0'' will reduce the Lanczos filter to point filter (a.k.a. no filtering / nearest neighbor). The Lanczos filtering kernel size can also be controlled by the ''width <wx> <wy>'' option. The kernel size defaults to 3x the blur size (separately in each direction), which is also known as the Lanczos3 downsampling kernel. The ''width <wx> <wy>'' option can override this setting (although this will be probably used very rarely). Fractional values are supported. The final ''pack'' option turns on the horizontal pixel packing (performed after the dithering), similar to the ''-downsacle HD'' option. In such case, the specified ''<xstep>'' value should usually be equal to half of the ''<ystep>'' to maintain the image aspect ratio. The ''-lanczos'' option is mutually exclusive with ''-downscale'' and ''-collapse''. The latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain> [<pathext>]'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). Optionally, a ''<pathext>'' name extension can be specified, which is added to the loaded file name for this light level. This allows loading a premade set of textures for light levels. ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: group TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' ==== Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. ==== -pixelpack ''<mode>'' ==== Enables packing pixels into logical pixel halves. Available ''<mode>'' methods are: * ''off'' - no packing performed * ''hd'' - packs pairs of pixels as logical pixel halves; half-transparent pixels become fully solid * ''hd_black'' - packs pairs of pixels as logical pixel halves; half-transparent pixels are padded with black color * ''xd'' - shifts the image left by one halfpixel; transparent pixels stay transparent; transparent pixels don't shift in * ''xd_wrap'' - like ''xd'', but rolls the texture instead * ''xd_narrow'' - shifts the image left by one halfpixel; half-transparent pixels become fully transparent * ''xd_wrap_narrow'' - like ''xd_narrow'', but rolls the texture instead ''HD'' modes reduce the image width by half. ''XD'' image modes keep the image width, but repack pixels for better display. If the image contains transparency, some pixels will be reduced in side to halfpixels. First pixel of a solid row of pixels will always be reduced. Last pixel of the row will either be reduced as well (''xd_narrow / xd_wrap_narrow'') or will become 1.5 pixel wide (''xd / xd_wrap'') to maintain the row length. The ''-pixelpack'' option could (partially) override the effect of the ''-downscale hd'' and ''-lanczos pack'' options. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. a2b7ad07a4b432c88fb43c5f6509665c332e65ce 130 129 2021-04-08T22:19:37Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -ramp ''<index1> <index2> ...'' === Specifies a color ramp to be used for dithering. This option should be specified before any ''-weight'' option. The first occurrence of ''-ramp'' and disallows dithering from using any color pair except when such colors are consecutive colors in the ramp. Further ramps can enable additional color pairs. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode> [{ ... ]'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space (sRGB) * ''xyz'' - XYZ color space * ''yuv'' - YUV color space * ''lab'' - CIE Lab color space * ''badlab'' - old broken implementation of the CIE Lab color space, which sometimes gave better results The colorspace block accepts following options: * ''-weights'' * ''-gamma'' * ''-luma'' ==== -weights ''<w1> <w2> <w3> [<w4>]'' ==== This option specifies per-channel weights for each component of the selected color space ('''R/G/B, Y/U/V, X/Y/Z'' or ''L/a/b''). E.g. a weight equal ''0'' means that the component should be ignored, where ''1'' means the default contribution. Additionally, the ''RGB'' color space introduces an optional 4th component of luminance. ==== -gamma ''<gr> [<gg> <gb>]'' ==== ''( RGB colorspace only )'' Specifies gamma value (per-channel, optionally) of the color space. E.g. using gamma value between ''2.0'' and ''2.4'' should make the RGB color space more or less linear. ==== -luma ''<wr> <wg> <wb>'' ==== ''( RGB colorspace only )'' Specifies per-channel weights for color luminance estimation. The weights are automatically normalized internally. If luminance error weight was not set (e.g. no ''-weights'' option was specified), the luminance weight is now set to ''1.0''. === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''font_mask'' - export ALL graphics of this asset group as 1bpp font with special header containing font information * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === ==== Graphics processing sequence ==== The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Downscaling (''-downscale / -collapse / -lanczos'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') * HD packing (''-downscale HD / -lanczos pack / -pixelpack'') * Trimming (''-trim'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse'' and ''-lanczos''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' and ''-lanczos'' - the latest specified option overrides previous ones. ==== -lanczos ''<x0> <y0> <xstep> [<ystep>] [blur <bx> [<by>]] [width <wx> [<wy>]] [pack]'' ==== Performs Lanczos downsampling of the image. This should allow quick asset prototyping by drawing the high resolution sketch of the art instead of pixeling it. The ''<x0>'' and ''<y0>'' specify the origin location coordinates on the high resolution image, which location after downscaling will be used as the final image origin. To produce downscaled image, the high resolution image is sampled in a grid pattern (each grid point produces one pixel of the final image). Samples are taken with steps specified by ''<xstep>'' and ''<ystep>'' (if the latter is missing, the grid is uniform). The sampling area is not specified directly and covers entire source image. The grid step values must be integer - fractional scaling is not supported now. For best results, the Lanczos filter blurs the image with blur size equal to the grid step. This can be overridden by specifying ''blur <bx> <by>'' option, which provides the blur size in both directions (specifying only one makes the blur uniform). Blur size is specified in pixels of the high resolution (source) image. Fractional blur sizes are supported. Specifying ''blur 0'' will reduce the Lanczos filter to point filter (a.k.a. no filtering / nearest neighbor). The Lanczos filtering kernel size can also be controlled by the ''width <wx> <wy>'' option. The kernel size defaults to 3x the blur size (separately in each direction), which is also known as the Lanczos3 downsampling kernel. The ''width <wx> <wy>'' option can override this setting (although this will be probably used very rarely). Fractional values are supported. The final ''pack'' option turns on the horizontal pixel packing (performed after the dithering), similar to the ''-downsacle HD'' option. In such case, the specified ''<xstep>'' value should usually be equal to half of the ''<ystep>'' to maintain the image aspect ratio. The ''-lanczos'' option is mutually exclusive with ''-downscale'' and ''-collapse''. The latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain> [<pathext>]'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). Optionally, a ''<pathext>'' name extension can be specified, which is added to the loaded file name for this light level. This allows loading a premade set of textures for light levels. ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' ==== Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. ==== -pixelpack ''<mode>'' ==== Enables packing pixels into logical pixel halves. Available ''<mode>'' methods are: * ''off'' - no packing performed * ''hd'' - packs pairs of pixels as logical pixel halves; half-transparent pixels become fully solid * ''hd_black'' - packs pairs of pixels as logical pixel halves; half-transparent pixels are padded with black color * ''xd'' - shifts the image left by one halfpixel; transparent pixels stay transparent; transparent pixels don't shift in * ''xd_wrap'' - like ''xd'', but rolls the texture instead * ''xd_narrow'' - shifts the image left by one halfpixel; half-transparent pixels become fully transparent * ''xd_wrap_narrow'' - like ''xd_narrow'', but rolls the texture instead ''HD'' modes reduce the image width by half. ''XD'' image modes keep the image width, but repack pixels for better display. If the image contains transparency, some pixels will be reduced in side to halfpixels. First pixel of a solid row of pixels will always be reduced. Last pixel of the row will either be reduced as well (''xd_narrow / xd_wrap_narrow'') or will become 1.5 pixel wide (''xd / xd_wrap'') to maintain the row length. The ''-pixelpack'' option could (partially) override the effect of the ''-downscale hd'' and ''-lanczos pack'' options. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. 8d6b800f5cfff4d1ca6ea38f63c9fa3d8319715d 129 128 2020-12-29T00:41:07Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -ramp ''<index1> <index2> ...'' === Specifies a color ramp to be used for dithering. This option should be specified before any ''-weight'' option. The first occurrence of ''-ramp'' and disallows dithering from using any color pair except when such colors are consecutive colors in the ramp. Further ramps can enable additional color pairs. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode> [{ ... ]'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space (sRGB) * ''xyz'' - XYZ color space * ''yuv'' - YUV color space * ''lab'' - CIE Lab color space * ''badlab'' - old broken implementation of the CIE Lab color space, which sometimes gave better results The colorspace block accepts following options: * ''-weights'' * ''-gamma'' * ''-luma'' ==== -weights ''<w1> <w2> <w3> [<w4>]'' ==== This option specifies per-channel weights for each component of the selected color space ('''R/G/B, Y/U/V, X/Y/Z'' or ''L/a/b''). E.g. a weight equal ''0'' means that the component should be ignored, where ''1'' means the default contribution. Additionally, the ''RGB'' color space introduces an optional 4th component of luminance. ==== -gamma ''<gr> [<gg> <gb>]'' ==== ''( RGB colorspace only )'' Specifies gamma value (per-channel, optionally) of the color space. E.g. using gamma value between ''2.0'' and ''2.4'' should make the RGB color space more or less linear. ==== -luma ''<wr> <wg> <wb>'' ==== ''( RGB colorspace only )'' Specifies per-channel weights for color luminance estimation. The weights are automatically normalized internally. If luminance error weight was not set (e.g. no ''-weights'' option was specified), the luminance weight is now set to ''1.0''. === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''font_mask'' - export ALL graphics of this asset group as 1bpp font with special header containing font information * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === ==== Graphics processing sequence ==== The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Downscaling (''-downscale / -collapse / -lanczos'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') * HD packing (''-downscale HD / -lanczos pack'') * Trimming (''-trim'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse'' and ''-lanczos''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' and ''-lanczos'' - the latest specified option overrides previous ones. ==== -lanczos ''<x0> <y0> <xstep> [<ystep>] [blur <bx> [<by>]] [width <wx> [<wy>]] [pack]'' ==== Performs Lanczos downsampling of the image. This should allow quick asset prototyping by drawing the high resolution sketch of the art instead of pixeling it. The ''<x0>'' and ''<y0>'' specify the origin location coordinates on the high resolution image, which location after downscaling will be used as the final image origin. To produce downscaled image, the high resolution image is sampled in a grid pattern (each grid point produces one pixel of the final image). Samples are taken with steps specified by ''<xstep>'' and ''<ystep>'' (if the latter is missing, the grid is uniform). The sampling area is not specified directly and covers entire source image. The grid step values must be integer - fractional scaling is not supported now. For best results, the Lanczos filter blurs the image with blur size equal to the grid step. This can be overridden by specifying ''blur <bx> <by>'' option, which provides the blur size in both directions (specifying only one makes the blur uniform). Blur size is specified in pixels of the high resolution (source) image. Fractional blur sizes are supported. Specifying ''blur 0'' will reduce the Lanczos filter to point filter (a.k.a. no filtering / nearest neighbor). The Lanczos filtering kernel size can also be controlled by the ''width <wx> <wy>'' option. The kernel size defaults to 3x the blur size (separately in each direction), which is also known as the Lanczos3 downsampling kernel. The ''width <wx> <wy>'' option can override this setting (although this will be probably used very rarely). Fractional values are supported. The final ''pack'' option turns on the horizontal pixel packing (performed after the dithering), similar to the ''-downsacle HD'' option. In such case, the specified ''<xstep>'' value should usually be equal to half of the ''<ystep>'' to maintain the image aspect ratio. The ''-lanczos'' option is mutually exclusive with ''-downscale'' and ''-collapse''. The latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain> [<pathext>]'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). Optionally, a ''<pathext>'' name extension can be specified, which is added to the loaded file name for this light level. This allows loading a premade set of textures for light levels. ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' ==== Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. 153bbc5d54cc3b46acc8cff88a755c378fe7b1b0 128 127 2020-12-29T00:32:25Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -ramp ''<index1> <index2> ...'' === Specifies a color ramp to be used for dithering. This option should be specified before any ''-weight'' option. The first occurrence of ''-ramp'' and disallows dithering from using any color pair except when such colors are consecutive colors in the ramp. Further ramps can enable additional color pairs. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode> [{ ... ]'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space (sRGB) * ''xyz'' - XYZ color space * ''yuv'' - YUV color space * ''lab'' - CIE Lab color space * ''badlab'' - old broken implementation of the CIE Lab color space, which sometimes gave better results The colorspace block accepts following options: * ''-weights'' * ''-gamma'' * ''-luma'' ==== -weights ''<w1> <w2> <w3> [<w4>]'' ==== This option specifies per-channel weights for each component of the selected color space ('''R/G/B, Y/U/V, X/Y/Z'' or ''L/a/b''). E.g. a weight equal ''0'' means that the component should be ignored, where ''1'' means the default contribution. Additionally, the ''RGB'' color space introduces an optional 4th component of luminance. ==== -gamma ''<gr> [<gg> <gb>]'' ==== ''( RGB colorspace only )'' Specifies gamma value (per-channel, optionally) of the color space. E.g. using gamma value between ''2.0'' and ''2.4'' should make the RGB color space more or less linear. ==== -luma ''<r> <g> <b>'' ==== ''( RGB colorspace only )'' Specifies per-channel weights for color luminance estimation. The weights are automatically normalized internally. If luminance error weight was not set (e.g. no ''-weights'' option was specified), the luminance weight is now set to ''1.0''. === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''font_mask'' - export ALL graphics of this asset group as 1bpp font with special header containing font information * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === ==== Graphics processing sequence ==== The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Downscaling (''-downscale / -collapse / -lanczos'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') * HD packing (''-downscale HD / -lanczos pack'') * Trimming (''-trim'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse'' and ''-lanczos''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' and ''-lanczos'' - the latest specified option overrides previous ones. ==== -lanczos ''<x0> <y0> <xstep> [<ystep>] [blur <bx> [<by>]] [width <wx> [<wy>]] [pack]'' ==== Performs Lanczos downsampling of the image. This should allow quick asset prototyping by drawing the high resolution sketch of the art instead of pixeling it. The ''<x0>'' and ''<y0>'' specify the origin location coordinates on the high resolution image, which location after downscaling will be used as the final image origin. To produce downscaled image, the high resolution image is sampled in a grid pattern (each grid point produces one pixel of the final image). Samples are taken with steps specified by ''<xstep>'' and ''<ystep>'' (if the latter is missing, the grid is uniform). The sampling area is not specified directly and covers entire source image. The grid step values must be integer - fractional scaling is not supported now. For best results, the Lanczos filter blurs the image with blur size equal to the grid step. This can be overridden by specifying ''blur <bx> <by>'' option, which provides the blur size in both directions (specifying only one makes the blur uniform). Blur size is specified in pixels of the high resolution (source) image. Fractional blur sizes are supported. Specifying ''blur 0'' will reduce the Lanczos filter to point filter (a.k.a. no filtering / nearest neighbor). The Lanczos filtering kernel size can also be controlled by the ''width <wx> <wy>'' option. The kernel size defaults to 3x the blur size (separately in each direction), which is also known as the Lanczos3 downsampling kernel. The ''width <wx> <wy>'' option can override this setting (although this will be probably used very rarely). Fractional values are supported. The final ''pack'' option turns on the horizontal pixel packing (performed after the dithering), similar to the ''-downsacle HD'' option. In such case, the specified ''<xstep>'' value should usually be equal to half of the ''<ystep>'' to maintain the image aspect ratio. The ''-lanczos'' option is mutually exclusive with ''-downscale'' and ''-collapse''. The latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain>'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' ==== Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. 33ff9f18bf7b115f5af84b143ff5192dd8f3f861 127 126 2020-12-18T21:57:12Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''font_mask'' - export ALL graphics of this asset group as 1bpp font with special header containing font information * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === ==== Graphics processing sequence ==== The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Downscaling (''-downscale / -collapse / -lanczos'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') * HD packing (''-downscale HD / -lanczos pack'') * Trimming (''-trim'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse'' and ''-lanczos''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' and ''-lanczos'' - the latest specified option overrides previous ones. ==== -lanczos ''<x0> <y0> <xstep> [<ystep>] [blur <bx> [<by>]] [width <wx> [<wy>]] [pack]'' ==== Performs Lanczos downsampling of the image. This should allow quick asset prototyping by drawing the high resolution sketch of the art instead of pixeling it. The ''<x0>'' and ''<y0>'' specify the origin location coordinates on the high resolution image, which location after downscaling will be used as the final image origin. To produce downscaled image, the high resolution image is sampled in a grid pattern (each grid point produces one pixel of the final image). Samples are taken with steps specified by ''<xstep>'' and ''<ystep>'' (if the latter is missing, the grid is uniform). The sampling area is not specified directly and covers entire source image. The grid step values must be integer - fractional scaling is not supported now. For best results, the Lanczos filter blurs the image with blur size equal to the grid step. This can be overridden by specifying ''blur <bx> <by>'' option, which provides the blur size in both directions (specifying only one makes the blur uniform). Blur size is specified in pixels of the high resolution (source) image. Fractional blur sizes are supported. Specifying ''blur 0'' will reduce the Lanczos filter to point filter (a.k.a. no filtering / nearest neighbor). The Lanczos filtering kernel size can also be controlled by the ''width <wx> <wy>'' option. The kernel size defaults to 3x the blur size (separately in each direction), which is also known as the Lanczos3 downsampling kernel. The ''width <wx> <wy>'' option can override this setting (although this will be probably used very rarely). Fractional values are supported. The final ''pack'' option turns on the horizontal pixel packing (performed after the dithering), similar to the ''-downsacle HD'' option. In such case, the specified ''<xstep>'' value should usually be equal to half of the ''<ystep>'' to maintain the image aspect ratio. The ''-lanczos'' option is mutually exclusive with ''-downscale'' and ''-collapse''. The latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain>'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' ==== Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. ed7a8433d238615de750d4b57b368728e7a269a3 126 125 2020-10-21T22:08:26Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''font_mask'' - export ALL graphics of this asset group as 1bpp font with special header containing font information * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === ==== Graphics processing sequence ==== The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Trimming (''-trim'') * Downscaling (''-downscale / -collapse'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') * HD packing (''-downscale HD'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain>'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' ==== Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. 1b5d03f8aeb6352508b11176c0377e4e4b7a547c 125 124 2020-10-21T21:59:04Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''font_mask'' - export ALL graphics of this asset group as 1bpp font with special header containing font information * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === ==== Graphics processing sequence ==== The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Trimming (''-trim'') * Downscaling (''-downscale / -collapse'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain>'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' ==== Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. 3f457989fb3ae6cdd404d69e89df11551be9a42e 124 123 2020-10-21T21:56:33Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === ==== Graphics processing sequence ==== The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Trimming (''-trim'') * Downscaling (''-downscale / -collapse'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain>'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' ==== Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. 96d86f79b7870d1f7034057aa3cacd7b65cad149 123 122 2020-10-21T21:56:15Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === ==== Graphics processing sequence ==== The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Trimming (''-trim'') * Downscaling (''-downscale / -collapse'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain>'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. debcd5045840b171a4cf65722bb9d91800a2b62a 122 121 2020-10-21T21:54:47Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. ==== -export ''[ <mode> ] ...'' ==== Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask ==== -export_amiga ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the Amiga platform. ==== -export_st ''[ <mode> ] ...'' ==== Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Trimming (''-trim'') * Downscaling (''-downscale / -collapse'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain>'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. 85a4f2316808043fa70b910bad427145cb5eeb43 121 120 2020-10-21T21:53:48Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === Generic asset options === ==== -verbose ''[<0/1>]'' ==== Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. ==== -path ''<path>'' ==== Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. ==== -masked ''[<0/1>]'' ==== Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. ==== -visualscale ''<scale> [<yscale>]'' ==== Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. ==== -texture ==== Marks assets to be used as wall textures in the engine. ==== -graphics ==== Marks assets to be used as generic graphics in the engine. E.g. for status bar display. ==== -flat ==== Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. ==== -weapon ==== Marks assets to be used as graphics for weapon the player is currently holding. ==== -weaponsprite ==== Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. ==== -object ==== Marks assets to be used as objects drawn in 3D world. === -export ''[ <mode> ] ...'' === Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask === -export_amiga ''[ <mode> ] ...'' === Similar to ''-export'', but provides export only for the Amiga platform. === -export_st ''[ <mode> ] ...'' === Similar to ''-export'', but provides export only for the ST platform. === Graphics asset processing options === The following options control operations performed on each loaded graphics asset. The operations are performed in order of appearance on the list below. The processing operation sequence is: * Color keying (''-colorkey'') * Scroll (''-scroll'') * Trimming (''-trim'') * Downscaling (''-downscale / -collapse'') * Color adjustsments (''-gamma / -gain / -lift / -lightlevel / -masterbrightness'') * Dithering (''-palette / -autopal'') ==== -colorkey ''<color> [<mask>]'' ==== The asset is preprocessed to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. ==== -scroll ''<dx> <dy>'' ==== Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. ==== -trim ''[<0/1>]'' ==== Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. ==== -downscale ''[<ratio> [<yratio>]]'' ==== This option downscales affected assets during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. ==== -collapse ''[<0/1>]'' ==== Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. ==== -gamma ''<gamma> [ <gamma2> <gamma3> ]'' ==== Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. ==== -gain ''<gain> [ <gain2> <gain3> ]'' ==== Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. ==== -lift ''<lift> [ <lift2> <lift3> ]'' ==== Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. ==== -lightlevel ''<lightvalue> <gain>'' ==== Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). ==== -nolight ==== Discards all specified light levels. Assets imported without light levels specified are imported unlit. ==== -palette ''<name> [ { ... ]'' ==== Specifies palette to dither/map the image to. The palette must already be defined beforehand before specifying this option. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } ==== -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. 4248d5c0f339333b44852b88fdd5d050a4a755b9 120 119 2020-10-08T08:48:38Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -scroll ''<dx> <dy>'' === Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -visualscale ''<scale> [<yscale>]'' === Provides visual scaling information used in the preview mode (most notably, for sizing the sprites). The ''<scale>'' is a real number scale factor (''1.0'' means no scaling, i.e. original file resolution is used). If ''<yscale>'' is not specified, the same scale is applied to both axes. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. === -export ''[ <mode> ] ...'' === Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask === -export_amiga ''[ <mode> ] ...'' === Similar to ''-export'', but provides export only for the Amiga platform. === -export_st ''[ <mode> ] ...'' === Similar to ''-export'', but provides export only for the ST platform. fe5e232334bea6c8f77cda006d17a81a8a7576cc 119 118 2020-10-08T08:42:08Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -scroll ''<dx> <dy>'' === Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. === -export ''[ <mode> ] ...'' === Forces the asset to be exported in the specified format, even if the resource is not hardcoded and has no references from usage in the project. Useful for exporting additional graphics (e.g. menus) without hardcoding the names into the tool. Available ''<mode>'' keywords. Any number of them can be specified: * ''off'' - do not export (for overriding the settings of the parent group) * ''bitplane'' - export as bitplanes, one after another, ending with mask bitplane (if graphics is masked) * ''bitplane_interleaved'' - export as line-interleaved bitplanes (option recognized, but not implemented) * ''bitplane_st'' - export as word-interleaved bitplanes (ST memory ordering, option recognized, but not implemented) * ''header'' - include simple header before the data (width, height, stride in bytes - one word each) * ''noheader'' - disable the above (for overriding parent group) * ''0bpp'' - export no color bitplanes (e.g. mask only for masked graphics) * ''1bpp'' - export color as 1 bitplane, with optional mask * ''2bpp'' - export color as 2 bitplanes, with optional mask * ''3bpp'' - export color as 3 bitplanes, with optional mask * ''4bpp'' - export color as 4 bitplanes, with optional mask * ''5bpp'' - export color as 5 bitplanes, with optional mask * ''6bpp'' - export color as 6 bitplanes, with optional mask === -export_amiga ''[ <mode> ] ...'' === Similar to ''-export'', but exports only for the Amiga platform. === -export-st ''[ <mode> ] ...'' === Similar to ''-export'', but exports only for the ST platform. 2b6cb51be152485ef28a1edb00f3d420bc74a391 118 117 2020-10-03T11:26:45Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -scroll ''<dx> <dy>'' === Scrolls (moves) the image pixels by specified offset. Image is wrapped across borders - pixels leaving one side, return from another. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 09a817ab1f9d01c1aa0e220642d3e9d23f013b2b 117 116 2020-10-02T22:43:15Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -masterbrightness ''<value>'' === Sets the brightness level for all the assets imported using this palette. This effect is applied on top of any other effects applied during import. === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. ec0bd16282ddaca23147a0daef4d705b993c8bd6 116 115 2020-10-02T22:34:54Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb [$rgb_out]'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. Optionally, the ''$rgb'' color can be followed by another color value in the same format, which be used as output color for preview rendering and export. In normal case, where there is only one, it's used both for import and export. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 75f9e1b31296ca55e5a067e8bc74bddb19dc3a7f 115 112 2020-09-30T19:17:44Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 20197811c35eaff51bae94bb35dd22d199ffcf17 112 111 2020-09-10T22:03:14Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. The loop point is currently an engine-only feature and DreadTool always repeats entire animation. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. The weapon swing simulation is currently an engine-only feature and DreadTool doesn't simulate the weapon swinging. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. ac3225906b066a127277d004f650220060b79899 111 110 2020-09-10T21:47:45Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''-loop'' * ''-walkswing'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== -loop ==== Places loop point in the animation. When animation is finished, playback restarts from this point. If loop point is missing, entire animation loops by default. To make the animation stay on the last frame place ''-loop'' point just before the last frame, preferably making the frame longer to save CPU power on frame switching logic. ==== -walkswing ''[<0/1>]'' ==== Enables or disables weapon swinging for frames following this definition. Every animation definition starts with walk swing disabled by default. If the argument is missing, it turns this option on. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 3935afc57d4ece9922370ab2c20919e1fe1de2b2 110 109 2020-08-10T10:46:25Z Krzysiek 1 /* -pairorder */ wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''y_checker'' - produces pattern by using ''sort'' or ''rev_sort'' method depending on pixel row * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 3f7daef019579183708e5f62d2356534b3c07db9 109 108 2020-08-10T09:40:58Z Krzysiek 1 /* -downscale [ []] */ wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''-downscale 0'' - downscaling disabled * ''-downscale 2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-downscale 1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''-downscale hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse''. The latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 040c19593c5c2d5667f4067e9e6a660253d92dd1 108 107 2020-08-10T09:35:10Z Krzysiek 1 /* Versions (A/B testing) */ wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. Names like ''A'' or ''B'' are only examples. Any version names can be used, but single letter ones are best to fit in the application UI. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''0'' - downscaling disabled * ''2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. ded281375f8739ba4ba32956ddc4e43cd6a671f1 107 106 2020-08-10T09:34:19Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Versions (A/B testing) == Parts of the file can be marked as conditional to allow faster changing of settings for A/B comparison. Example: palette Main { $000 version A { $222 $333 $555 } version B { $111 $333 $444 } $777 ... } In the above example version conditions are used to quickly change the gray ramp in the palette. Adding the ''version'' block causes all used version labels to appear in the tool UI as clickable buttons. Clicking one of them deselects all other versions and selects/deselects the clicked one. Alternatively, you can hold down the ''Control'' key to select multiple versions together. Any change in the UI version buttons causes all the assets to reload with new version settings. Every version label (e.g. ''A'', ''B''... but any names can be used) is a flag always set to either ''true'' or ''false''. For A/B testing, normally only one version is set to ''true'' and the rest is set to ''false'', but deselecting and ''Ctrl+click'' allows to specify any flag combination in the tool. The ''version'' statement in the ''assets.txt'' files is followed by list of version labels, with optional negations, that specify when the version block should be included, and when it shouldn't. If negated and non-negated flags are mixed, the rightmost flag that has value of ''true'' takes precedence. Examples: * ''version A'' - include the block when ''A' is selected * ''version !A'' - include the block when version ''A'' is NOT selected * ''version A B C'' - include the block when at least one of ''A'', ''B'' and ''C'' is selected * ''version !A !B !C'' - include the block when none of ''A'', ''B'' and ''C'' is selected * ''version !A !B'' - include the block when neither ''A'' nor ''B'' is selected * ''version A !B'' - if ''B'' is selected (rightmost flag) then ignore the block, otherwise include it if ''A'' is selected * ''version !B A'' - if ''A'' is selected (rightmost flag) then use the block, otherwise use it if ''B'' is not selected * ''...'' The ''version'' statement can be used anywhere in the file - in any other block, or at the top level. The versions selected in the UI are saved upon exit in the ''config.cfg'' file. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''0'' - downscaling disabled * ''2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. cbf18b06744f94e93b651da9d4fea3cf39f369bb 106 105 2020-08-10T08:44:01Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio> [<yratio>]]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''0'' - downscaling disabled * ''2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''1 2'' - scale image down only vertically by 50% by averaging vertical 1x2 pairs of pixels * ''hd'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Ratio of ''-2'' has currently the same meaning as ''hd'', but is deprecated. Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 54df9a2c7a700dea78fe63fb4d766789f330d04c 105 104 2020-07-14T22:21:11Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -verbose ''[<0/1>]'' === Controls printing additional debug info during import of affected assets. If the argument is missing, it turns this option on. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio>]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''0'' - downscaling disabled * ''2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-2'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 572d16774e48d999768f68dff52adaba4942a495 104 103 2020-07-14T22:15:42Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Include == Additional files can be included at any point in the file. Include path is relative to path of the file currently being processed. Example: include "included-file-name.txt" == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the directory of the definition file. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio>]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' values are: * ''0'' - downscaling disabled * ''2'' - scale image down by 50% by averaging 2x2 groups of pixels * ''-2'' - downscale vertically by 50%, then after dithering downscale horizontally by packing pixel pairs into vertical logic pixel halves Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. ada9353db82d4ac666275c843e435080164b29c7 103 102 2020-07-14T20:46:55Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position * ''solid_checker'' - produces solid pixel checkerboard pattern by picking alternatively one or the other half of the logic pixel === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === anim ''<name> { ...'' === Defines animation preview using previously defined frames. Except for special cases, the animation is for preview only and not used in the engine. Animation ''<name>'' is used only for description. Animation block can contain following definitions: * ''-name'' * ''frame'' ==== -name ''<anim-name>'' (''anim'' block only) ==== Assigns reference name to the animation to allow using it from scripts (e.g. for sprite animation). The name must be unique in the project. ==== frame ''<time> <gfx> [ <xoff> <yoff> ]'' (''anim'' block only) ==== Specifies animation frame. Graphics asset ''<gfx>'' will be displayed for ''<time>'' ticks (one tick = 1/300s). If either or both ''<gfx>'' and ''<time>'' is replaced with ''-'' or ''*'' character, time or graphics from previous frame definition are repeated. Optionally, offsets can be specified to move the graphics. === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the working directory. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -trim ''[<0/1>]'' === Turns image trimming on or off. If the argument is missing, it trimming is enabled. Trimming causes transparent areas around the image to be cut off and updates asset offsets to maintain the correct position. This might help reducing memory usage and improve performance by limiting the asset only to the required region. === -downscale ''[<ratio>]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' is 2, which scales images down by 50% by averaging 2x2 groups of pixels. Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -weaponsprite === Marks assets to be used as hardware sprite graphics for weapon the player is currently holding. === -object === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -autopal ''[<base-palette>] <max-colors> [ { ... ]'' === Creates and uses new palette, optionally copying the ''<base-palette>''. Specify ''*'' as ''<base-palette>'' to use current palette as the base palette. When assets are imported using this palette, new colors are added to it until it reaches ''<max-colors>''. Palette block for the new palette may follow this definition. When importing assets with hardware color count limitations (e.g. weapon sprites), make sure to specify ''<max-colors>'' above the true hardware limit. This way palette overflow errors can be detected later. === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. b0d6c7e5241d830777f3bf947ca3850933868df9 102 101 2020-06-21T10:58:31Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the working directory. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -colorkey ''<color> [<mask>]'' === Enables preprocessing of the asset to convert specific color into transparent regions. Color and optional mask should be specified in the ''0xRRGGBB'' format as a hex number. Alternatively, you can use * in place of ''<color>'', in which case the converter uses the upper-left pixel of each image as its transparent color. If ''<color>'' parameter is the word "off", color keying is disabled. Turning the color key on or off also automatically enables or disables the ''-masked'' option. === -downscale ''[<ratio>]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' is 2, which scales images down by 50% by averaging 2x2 groups of pixels. Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -sprite === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. c99ee1368942e61daf0f0d3d758006ea8747c619 101 100 2020-06-20T22:48:39Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' {{toclimit|limit=2} == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the working directory. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -downscale ''[<ratio>]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' is 2, which scales images down by 50% by averaging 2x2 groups of pixels. Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -collapse ''[<0/1>]'' === Turns on or off collapsing of the asset. When collapsing is on, entire asset image is averaged down to a single pixel. Useful for floor "textures" replaced by a single color. Not useful anywhere else. Mutually exclusive with ''-downscale'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -sprite === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 3f55243a4cbf506e3318ef7679e7029ea47ff756 100 99 2020-06-20T22:25:27Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' {{toclimit|limit=2} == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the working directory. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -downscale ''[<ratio>]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' is 2, which scales images down by 50% by averaging 2x2 groups of pixels. Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -sprite === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -gamma ''<gamma> [ <gamma2> <gamma3> ]'' === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ]'' === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ]'' === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. d4db041f6162c2e8dc4208cee6c893aee7b4361d 99 98 2020-06-20T22:22:59Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' {{toclimit|limit=2} == File Structure == The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... == Comments == The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. == Palette definition == A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } === $''rgb'' (color definition) === A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. === -weight ''<color1> <color2> <weight>'' === Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all === -mainpal === Sets the palette as the main palette to be used for rendering 3D world. === -hudpal === Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). === -colorspace ''<mode>'' === Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space === -dither ''<mode>'' === Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) === -pairorder ''<mode>'' === Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position === -mixpenalty ''<weight> [<wr> <wg> <wb>]'' === When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === -errordiffuse ''<right> <downleft> <down> <downright>'' === Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. === -diffuseweights ''<wr> <wg> <wb>'' === Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. === palette ''<name>'' { ... === You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } == Asset group definition == Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } === gfxgroup ''<name>'' { ... === Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } === gfx ''<name> [<xoff> <yoff>] [ { ... ]'' === Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } === -path ''<path>'' === Specifies path of the directory, from which assets of the group should be imported. The path is relative to the working directory. If the path contains spaces, it should be enclosed in quotes. But better: don't use paths and names with spaces. === -masked ''[<0/1>]'' === Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. === -downscale ''[<ratio>]'' === This option causes affected assets to be downscaled during import. The only supported ''<ratio>'' is 2, which scales images down by 50% by averaging 2x2 groups of pixels. Mutually exclusive with ''-collapse'' - the latest specified option overrides previous ones. === -texture === Marks assets to be used as wall textures in the engine. === -graphics === Marks assets to be used as generic graphics in the engine. E.g. for status bar display. === -flat === Marks assets to be used as solid color for floor. Specifying this option automatically enables the ''-collapse'' option. === -weapon === Marks assets to be used as graphics for weapon the player is currently holding. === -sprite === Marks assets to be used as objects drawn in 3D world. === -palette ''<name> [ { ... ]'' === Selects a palette to be used for importing the assets. The palette must already be defined beforehand before specifying this potion. No assets can be imported before a palette is chosen. Optionally, a new palette block can be specified, which creates a new palette based on the specified one, but with possibly new options. If a palette is already loaded (e.g. by a parent asset group), a ''*'' can be used for name to use the current palette as a base of the option block. Example: gfxgroup TexturesNotDithered { -palette Main { // Create copy of palette 'Main', disable dithering error diffusion and use it -errordiffuse 0 0 0 0 } // specify some assets here } === -gamma ''<gamma> [ <gamma2> <gamma3> ] === Selects the gamma correction value to be applied during import of the asset. If three gamma values are specified, they are used for each component separately, depending on the selected color space. === -gain ''<gain> [ <gain2> <gain3> ] === Specifies the color multiplier to be applied during import of the asset. If three gain values are specified, they are used for each component separately, depending on the selected color space. === -lift ''<lift> [ <lift2> <lift3> ] === Specifies the value added to the color during import of the asset. If three lift values are specified, they are used for each component separately, depending on the selected color space. The gamma/gain/lift operations are applied exactly in this order, with: * gamma - using power function with given exponent on each color component * gain - multiplying the result by given value, per component * lift - adding specified value to each color component All operations are performed in the chosen color space - ''RGB'' or ''CIELab''. === -lightlevel ''<lightvalue> <gain>'' === Specifies one light level for the affected assets. ''<lightvalue>'' is an integer 0..255 describing light intensity as used in imported WAD file. ''<gain>'' is the extra value, that is used when importing an asset at this light level. The ''<gain>'' value is used on top of the value specified with ''-gain'' option, not replacing it. If any light level is specified for current group, all light levels inherited from the parent group are discarded, so all required light levels must always be specified together. When WAD files are converted, assets from closest specified light level are used (the converter never adds extra light levels by itself). === -nolight === Discards all specified light levels. Assets imported without light levels specified are imported unlit. 551e935d0eea95afde981362567cd58aedd750dd 98 97 2020-06-20T21:38:25Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' === File Structure === The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... === Comments === The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. === Palette definition === A palette is defined by specifying color values and dithering options. Palette is defined at the top level of the ''assets.txt'' file, within other palettes or special options (described later). Every palette has a name, allowing it to be referenced. Palette names must be unique. Use the following syntax. palette NameOfMyPalette { // place colors, dithering options and sub-palettes here } ; $''rgb'' (color definition) A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. ; -weight ''<color1> <color2> <weight>'' Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all ; -mainpal Sets the palette as the main palette to be used for rendering 3D world. ; -hudpal Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). ; -colorspace ''<mode>'' Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space ; -dither ''<mode>'' Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) ; -pairorder ''<mode>'' Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position ; -mixpenalty ''<weight> [<wr> <wg> <wb>]'' When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence of the mixing. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. ; -errordiffuse ''<right> <downleft> <down> <downright>'' Enables dithering error diffusion. When final color is computed (or average of two color halves of logical pixel), its difference from ideal color is computed and error is spread to neighboring pixels not yet processed. This causes these pixels to partially compensate for the error, or spread the error further accumulating until correction is done. All specified weights should be zero or greater and sum up to 1 or less. ; -diffuseweights ''<wr> <wg> <wb>'' Applies extra per-component weights to the error diffusion. In case of the CIELab color space, the weights will be for ''L'', ''a'' and ''b''. ; palette ''<name>'' { ... You can define a palette inside another palette, using new, unique palette name. The derived palette will initially have all colors and options of the parent palette copied, which could be then further changed. You can also add new colors to the palette. This sub-palette specification is most useful, when you want to keep the colors of the palette, but specify different dithering options for some assets. For example: palette Main { -mainpal -dither half_closest -pairorder sort -errordiffuse 0.328 0.141 0.234 0.047 $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | palette Main_Weapon { // reduce spreading of color error, to prevent red dithering spots on weapon hands -diffuseweights 1.0 0.2 0.2 -mixpenalty 0.1 } } === Asset group definition === Asset group is a virtual "folder" containing similar assets, often sharing same import settings. A palette is defined by specifying color values and dithering options. Asset group is either defined at the top level of the ''assets.txt'' file or within other asset groups. Use the following syntax. gfxgroup NameOfMyAssetGroup { // place options, sub-groups and assets here } ; gfxgroup ''<name>'' { ... Create another sub-group inside this one. The sub-group will inherit all options of the parent group, which can be modified further. This nested grouping will also show in the importer as nested asset categories, which will be useful for browsing the assets. Example: gfxgroup Objects { gfxgroup Monsters { gfxgroup Soldier { // place actual assets here } gfxgroup AnotherMonster { // place actual assets here } } } ; gfx ''<name> [<xoff> <yoff>] [ { ... ]'' Specifies asset within the asset group. The asset name must be globally unique, and will be used both for the asset name and the source file name, so name your files accordingly. You can optionally provide graphics offsets, which will be used to correctly position objects in 3D world or weapon graphics (not used with textures). Optionally, you can also start a new, hidden group, in which this asset will be placed. Example: gfxgroup Textures { // Options for all textures in this group gfx WALL47_1 { // Hidden group for this texture only, specifying options for this asset alone. } gfx RW11_3 gfx RW23_4 } ; -masked ''[<0/1>]'' Specifies whether transparency masking should be used by assets in this group. If the argument is missing, it turns the masking on. The setting here must match the usage in the engine, e.g. enabling masking for textures won't make textures transparent in game. When masking is turned on, alpha channel of the imported graphics is used - pixels with alpha 127 or lower are transparent. 5df30c387d464f82ebb6cffe4df8d4865de7536c 97 96 2020-06-17T23:08:37Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' === File Structure === The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... === Comments === The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. === Palette definition === A palette is defined by specifying color values and dithering options. Use the following syntax. ; $''rgb'' (color definition) A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). Example: $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | Comments are optional, but help. ; -weight ''<color1> <color2> <weight>'' Allows to modify likelihood, with which given color pair will be used. Color order does not matter. ''<color2>'' can be replaced with ''*'' to affect all color combinations with ''<color1>''. ''<weight>'' equal ''0'' disables given combination. -weight 13 15 0.5 // reduce usage of yellow-darkred pair (according to the palette above) -weight 14 * 0 // don't use bright red at all ; -mainpal Sets the palette as the main palette to be used for rendering 3D world. ; -hudpal Sets the palette as the main palette to be used for HUD drawing (a.k.a. the status bar). ; -colorspace ''<mode>'' Specifies the color space in which conversion and dithering error will be computed. Possible ''<mode>'' values are: * ''rgb'' - standard RGB space * ''lab'' - CIE Lab color space ; -dither ''<mode>'' Selects the dithering algorithm. Possible ''<mode>'' values are: * ''solid'' - best color is chosen to use for entire logical pixel ("vertical" dithering disabled) * ''full'' - all color pairs are checked and best pair is used for the logical pixel (full "vertical" dithering) * ''half_closest'' - one color is chosen closest to the target color (ignoring error diffusion), the the second color is picked (with error diffusion) to make best color pair * ''checker'' - similar to ''full'', but a 2x2 logic pixel block is used, as well as vertical dithering to produce 3 intermediate colors for each color pair * ''checker_closest'' - similar to ''checker'', but one of the colors is picked for closest, undithered match (as in ''half_closest'' method) ; -pairorder ''<mode>'' Selects the order in which colors are placed when coloring logic pixel halves separately ("vertical" dithering). Possible ''<mode>'' values are: * ''keep'' - keep the order produced by the dithering method (useful with ''checker'' and ''checker_closest'') * ''sort'' - colors are placed in order of their index in the palette * ''rev_sort'' - similar to ''sort'', but the order is reversed * ''checker'' - produces checkerboard pattern by using ''sort'' or ''rev_sort'' method depending on pixel position ; -mixpenalty ''<weight> [<wr> <wg> <wb>]'' When dithering algorithm considers using a color pair instead of a solid color, this option adds error proportional to ''<weight>'' and difference of the two colors considered. Optionally, per-component weights can be specified controlling influence 5f264d25580ba68fe4b0540ef8ed6c5b80d0647b 96 95 2020-06-17T09:41:03Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' === File Structure === The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... === Comments === The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. === Palette definition === A palette is defined by specifying color values and dithering options. Use the following syntax. ; $xxx (color definition) A dollar sign ''$'' within palette definition adds one color to the palette. 3 hex digits specify the value of red, green and blue components, 4 bits per component (Amiga OCS precision). $000 // black $222 // gray ramp $333 // | $555 // | $777 // | $BBB // | $FFF // white $343 // green ramp $573 // | $774 // | $004 // blue $320 // brown $431 // brown $CA5 // yellow $C00 // red $600 // | 78188da50ecf8b4a6d30fca6e104f5c9aec0c722 95 94 2020-06-16T22:21:18Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the infrmation is still to be filled'' === File Structure === The ''assets.txt'' file controls what assets are imported, and how the import process is performed. The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... === Comments === The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. === Palette definition === A palette is defined by specifying color values and dithering options. ; Color 41a9beb72dfca4a4e96b323a2966e297c73850bb 94 2020-06-16T21:05:45Z Krzysiek 1 Created page with "[[Category:dreadtool]] The ''assets.txt'' file controls what assets are imported, and how the import process is performed. === File Structure === The file is a list of defin..." wikitext text/x-wiki [[Category:dreadtool]] The ''assets.txt'' file controls what assets are imported, and how the import process is performed. === File Structure === The file is a list of definition entries. Using one of the following keywords: * ''palette'' * ''gfxgroup'' Example ''assets.txt'' file could have the following structure: palette Main { ... define palette 'Main' here ... } palette HUD { ... define palette 'HUD' here ... } ... define other palettes if needed ... gfxgroup Textures { ... specify group contents ... } ... define other groups and/or palettes ... === Comments === The file accepts both C-style single line comments, and shell-style comments. // This is a comment. # This is a comment too. === Palette definition === A palette is defined by specifying color values and dithering options. ; Color 664e6e0ba5d734c6107bdb15e2a5e2c8a22cf58a Creating new map 0 29 141 2021-09-07T20:12:46Z Krzysiek 1 Created page with " == Run Doom Builder 2 and create new map == To create new Dread map, follow these steps: # Run the ''Doom Builder 2'' and click the ''New map'' button. # Select ''KK (Dread..." wikitext text/x-wiki == Run Doom Builder 2 and create new map == To create new Dread map, follow these steps: # Run the ''Doom Builder 2'' and click the ''New map'' button. # Select ''KK (Dread in Doom format)'' game configuration. Keep ''Level name'' as ''MAP01''. # Click ''Add resource..'' button to add resources. # ''Add resource'' dialog pops up. Select ''From Directory'' tab. # On this tab, enter ''Directory Resource'' folder selector and navigate to where you have unpacked the ''dreadtool.exe''.<br/>Select the ''pk3'' directory that exists next to the ''dreadtool.exe''. # Confirm the ''Add resource'' dialog with ''OK''. # Confirm the ''Map options'' dialog with ''OK''. Now you can start creating your own map. I strongly suggest placing ''Player 1 start'' thing at coordinates ''(0,0)'' as Dread supports limited coordinate range. Next, create at least two convex sectors - the minimum number required to import correctly in ''Dreadtool''. == Run DreadTool == To see a preview of your map in ''Dreadtool'', please: # Edit the ''project.cfg'' next to ''dreadtool.exe'' and set ''map-wad'' to the path of your ''WAD'' file.<br/>Please use only forward slashes ''/'' in the path. # Run ''dreadtool.exe''. Your map should immediately load and convert. # In the toolbar on the right select ''3D'' in the top button row, if not already selected. # In the ''3D'' mode, the second toolbar button row chooses one of the following renderers: ## ''GPU'' - draws the map using ''DirectX 9''. Can draw item previews, but ignores vertical texture offsets. ## ''Dread'' - software renderer. Uses vertical texture offsets, but can't draw things. It's my field for experiments, so it might break. # Use right mouse button on the camera view and ''WASD'' to move around your map. You can keep both ''Dreadtool'' and ''Doom Builder 2'' open next to each other. Any time you save the ''WAD'' file, ''Dreadtool'' will automaticaly pickup the changes, which gives near WYSIWYG experience. == Dread maps limitations == The most important limitations for maps are currently: # All floor heights should be at level ''0'. # All ceiling heights should be at level ''64'', ''96'' or ''128''. # The light levels supported by default are ''128'' and ''255''. Other light levels will be rounded to these two. # All sectors must be convex (collinear lines are OK). Split sector in convex sectors when required (don't worry, invisible lines are free). # Use only the textures contained in the ''PK3'' structure from ''Dreadtool'' (you can add textures in ''Dreadtool'' and update the ''PK3''). # Watch vertical texture offsets. All wall textures have pink bar at the bottom. Make sure this bar is invisible in the preview or the rendering may draw garbage there. # For floors and ceilings use only flat color textures. Alternatively, use ''F_SKY1'' for ceiling to draw sky. # For walls use only wall textures - the ones with the pink bar at the bottom. # No wall should be longer than ''512'' units or texturing will break. Split lines with a vertex when necessary. f9ec934319588bd861f3995691bbddc99c65793e Dreadtool 0 22 142 139 2021-09-07T21:55:35Z Krzysiek 1 wikitext text/x-wiki Dreadtool.exe is the WIP tool used to convert assets for Dread game. Basic topics: * [[SDK setup]] * [[Creating new map]] * [[Adding custom assets]] * [[Advanced mapping tricks]] Advanced reference documentation: * [[assets.txt]] * [[project.cfg]] 0f6f648536532dd6695a1a8b09ae51021d3e7953 139 136 2021-09-07T20:00:20Z Krzysiek 1 wikitext text/x-wiki Dreadtool.exe is the WIP tool used to convert assets for Dread game. Basic topics: * [[SDK setup]] * [[Creating new map]] * [[Advanced mapping tricks]] Advanced reference documentation: * [[assets.txt]] * [[project.cfg]] 6596a41c077a50ce45df384d868cface1951f66d 136 132 2021-09-07T19:23:55Z Krzysiek 1 wikitext text/x-wiki Dreadtool.exe is the WIP tool used to convert assets for Dread game. Basic topics: * [[SDK setup]] * [[Creating new map]] Advanced reference documentation: * [[assets.txt]] * [[project.cfg]] d0c9603da8f68a7e83941b13cc693b341716d1d4 132 113 2021-09-06T21:03:51Z Krzysiek 1 wikitext text/x-wiki Dreadtool.exe is the WIP tool used to convert assets for Dread game. Covered topics: * [[SDK setup]] * [[assets.txt]] * [[project.cfg]] e6e4e25e228efd1505af089099ed66beb6a895c4 113 93 2020-09-30T19:08:30Z Krzysiek 1 wikitext text/x-wiki Dreadtool.exe is the WIP tool used to convert assets for Dread game. Covered topics: * [[assets.txt]] * [[project.cfg]] 4051b1bcc77a48908444914cae54bbbd83ce61ab 93 2020-06-16T20:33:21Z Krzysiek 1 Created page with "Dreadtool.exe is the WIP tool used to convert assets for Dread game. Covered topics: * [[assets.txt]]" wikitext text/x-wiki Dreadtool.exe is the WIP tool used to convert assets for Dread game. Covered topics: * [[assets.txt]] 8f8cf55b0c5204b08ab8bf39828e74292c5d84f3 K65 0 4 91 89 2017-06-22T20:28:28Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''K65''' is a compiler for [[wikipedia:MOS Technology 6502|6502 CPU]] architecture. At this moment it supports Atari 8-bit (400/800/XL/XE), Commodore 64 and Atari 2600 as target platforms. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Evaluator]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * [[K65 To Do]] * '''[[K65 Downloads]]''' * [[K65 Changelog]] * [[Alternate VCS definitions]] * [[Projects using K65]] afad1167f1aba34881296c8ed5d2541d1ba7ba53 89 75 2016-11-10T22:22:15Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''K65''' is a compiler for [[wikipedia:MOS Technology 6502|6502 CPU]] architecture. At this moment it supports only [[wikipedia:Atari 2600|Atari 2600]] as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Evaluator]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * [[K65 To Do]] * '''[[K65 Downloads]]''' * [[K65 Changelog]] * [[Alternate VCS definitions]] * [[Projects using K65]] 68d40d8456598ab8e9902219e043549bd28f7925 75 74 2014-12-28T23:29:08Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''K65''' is a compiler for [[wikipedia:MOS Technology 6502|6502 CPU]] architecture. At this moment it supports only [[wikipedia:Atari 2600|Atari 2600]] as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Evaluator]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * [[K65 To Do]] * '''[[K65 Downloads]]''' * [[Alternate VCS definitions]] * [[Projects using K65]] ff522269291ecdfa9d3194b507f520ade29f77f6 74 72 2014-12-28T23:28:55Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''K65''' is a compiler for [[wikipedia:MOS Technology 6502|6502 CPU]] architecture. At this moment it supports only [[wikipedia:Atari 2600|Atari 2600]] as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Evaluator]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * '''[[K65 Downloads]]''' * [[K65 To Do]] * [[Alternate VCS definitions]] * [[Projects using K65]] 56a5e770d8cadb7e093ee7e0059df10a08b722e1 72 58 2014-12-21T12:35:26Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''K65''' is a compiler for [[wikipedia:MOS Technology 6502|6502 CPU]] architecture. At this moment it supports only [[wikipedia:Atari 2600|Atari 2600]] as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Evaluator]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * '''[[K65 Downloads]]''' * [[Alternate VCS definitions]] * [[Projects using K65]] 3eca37996f344daa12456aa5a2da9b48999d716d 58 55 2014-12-21T02:16:47Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''K65''' is a compiler for [[wikipedia:MOS Technology 6502|6502 CPU]] architecture. At this moment it supports only [[wikipedia:Atari 2600|Atari 2600]] as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Evaluator]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * '''[[K65 Downloads]]''' * [[Projects using K65]] d507f93c36a4cd0973191f32ffc9b0f5fb926a50 55 48 2014-12-19T23:10:12Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''K65''' is a compiler for [[wikipedia:MOS Technology 6502|6502 CPU]] architecture. At this moment it supports only [[wikipedia:Atari 2600|Atari 2600]] as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Evaluator]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * [[Projects using K65]] ecdc3a3acad89f5ab718fe106a6a4504daa80e76 48 35 2014-12-19T22:12:15Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''K65''' is a compiler for 6502 CPU architecture. At this moment it supports only Atari 2600 as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Evaluator]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * [[Projects using K65]] b3ab314ade53b40df0368c623ab099c64b9e5f89 35 31 2014-12-15T22:07:33Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''K65''' is a compiler for 6502 CPU architecture. At this moment it supports only Atari 2600 as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * [[Projects using K65]] 483b6b1746070999f346c845eeb8377ebcf2204a 31 30 2014-12-11T12:01:56Z Krzysiek 1 wikitext text/x-wiki '''K65''' is a compiler for 6502 CPU architecture. At this moment it supports only Atari 2600 as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Tutorials]] * [[K65 Known Bugs]] * [[Projects using K65]] adde5ade4b73675aa02e621b6d8232b1b05f34f8 30 21 2014-12-11T12:01:48Z Krzysiek 1 wikitext text/x-wiki '''K65''' is a compiler for 6502 CPU architecture. At this moment it supports only Atari 2600 as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [K65 Tutorials]] * [[K65 Known Bugs]] * [[Projects using K65]] ae0b2a92b2973d331bac3fe1c6b2a7812265fdd9 21 19 2014-12-11T11:03:40Z Krzysiek 1 wikitext text/x-wiki '''K65''' is a compiler for 6502 CPU architecture. At this moment it supports only Atari 2600 as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Syntax]] * [[K65 Instructions]] * [[K65 Known Bugs]] * [[Projects using K65]] ef5e8dc0cda033369140a9f0c3d1e73e0f325d3b 19 10 2014-12-11T10:09:25Z Krzysiek 1 wikitext text/x-wiki '''K65''' is a compiler for 6502 CPU architecture. At this moment it supports only Atari 2600 as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Instructions]] * [[K65 Known Bugs]] * [[Projects using K65]] 14c409a6b7af07500e5dcce59ff116bd429825a8 10 2014-12-11T09:46:16Z Krzysiek 1 Created page with "'''K65''' is a compiler for 6502 CPU architecture. At this moment it supports only Atari 2600 as target platform. This documentation wiki is currently being built. Existing..." wikitext text/x-wiki '''K65''' is a compiler for 6502 CPU architecture. At this moment it supports only Atari 2600 as target platform. This documentation wiki is currently being built. Existing K65 documentation pages so far: * [[K65 Instructions]] * [[K65 Known Bugs]] ff4186c65802eeb9c2efecdb6b920517e83e5248 K65 Changelog 0 21 90 2016-11-10T22:27:15Z Krzysiek 1 Created page with "'''[[K65]]''' Changelog: ==== K65 SDK Version 0.2.1 ==== * New example Atari 2600 demo sources included: [https://www.pouet.net/prod.php?which=64492 Ascend] and [http://www.p..." wikitext text/x-wiki '''[[K65]]''' Changelog: ==== K65 SDK Version 0.2.1 ==== * New example Atari 2600 demo sources included: [https://www.pouet.net/prod.php?which=64492 Ascend] and [http://www.pouet.net/prod.php?which=65838 Derivative 2600] by Cluster & DMA * Linker now reports final section sizes again * Minor compiler bugfixes * ''FIX:'' Atari XL/XE and C64 systems sometimes exported truncated images 2c8b8f96bb71ac349508f2a51f199c04b4c43671 K65 Downloads 0 18 88 84 2016-11-10T22:21:33Z Krzysiek 1 wikitext text/x-wiki '''[[K65]]''' has following downloads currently available: * [http://devkk.net/files/k65-sdk-0.2.1.zip K65 SDK version 0.2.1] Older releases: * [http://devkk.net/files/k65-release-0.2.0.zip K65 SDK version 0.2.0] * [http://devkk.net/files/k65-release.zip K65 SDK version 0.1.2] af322c38cc4ffc64391fa9bf1845597bab894c52 84 59 2015-07-31T21:28:40Z Krzysiek 1 wikitext text/x-wiki '''[[K65]]''' has following downloads currently available: * [http://devkk.net/files/k65-release-0.2.0.zip K65 SDK version 0.2.0] Older releases: * [http://devkk.net/files/k65-release.zip K65 SDK version 0.1.2] 68c9895965b2bf1c8690bcc60ee9b10f6a28bc3e 59 57 2014-12-21T02:16:59Z Krzysiek 1 wikitext text/x-wiki '''[[K65]]''' has following downloads currently available: * [http://devkk.net/files/k65-release.zip Work-in-Progress version SDK] 4db35bb9e9fd6173b373a95396db99b0af946ac3 57 2014-12-21T02:16:11Z Krzysiek 1 Created page with "[[K65]] has following downloads currently available: * [http://devkk.net/files/k65-release.zip Work-in-Progress version SDK]" wikitext text/x-wiki [[K65]] has following downloads currently available: * [http://devkk.net/files/k65-release.zip Work-in-Progress version SDK] 5dd7a24fe87574be58fffc64ae215fdcfaa3c21a K65 Evaluator 0 17 78 61 2015-06-12T12:51:51Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] __FORCETOC__ Evaluator in '''[[K65]]''' is compile-time executed expression language very similar to C/C++ expressions. === Evaluator introduction === In every place where the compiler expects a single number, you can invoke the evaluator by simply using square brackets. data NumberFour { [2+2] } The evaluator can be also invoked freely outside any section body, e.g. to set variables: [ FOUR = 4 ] which can be later used freely as compiler constants and within further evaluator expressions: data FourFiveSix { FOUR // value of variable FOUR defined earlier [FIVE = FOUR+1] // defines variable FIVE and returns its value [FIVE+1] // uses recently set FIVE value } === Evaluator operators === Available operators and their precedence levels are similar to [[wikipedia:Operators_in_C_and_C++#Operator_precedence|operators in C and C++]] {| class="wikitable" |- ! style="text-align: left" | Precedence ! style="text-align: left" | Operator ! style="text-align: left" | Description ! style="text-align: left" | Associativity |- ! rowspan=5| 2 <small>highest</small> | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Suffix increment | style="vertical-align: top" rowspan="5" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Suffix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>()</code> | style="border-bottom-style: none; border-top-style: none" | Function call |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>[]</code> | style="border-bottom-style: none; border-top-style: none" | Array subscripting |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>.</code> | style="border-bottom-style: none; border-top-style: none" | Single argument function call |- ! rowspan=6| 3 | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Prefix increment | style="vertical-align: top" rowspan="6" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Prefix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none; border-top-style: none" | Unary plus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Unary minus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!</code> | style="border-bottom-style: none; border-top-style: none" | Logical NOT |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>~</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise NOT (One's Complement) |- ! rowspan=3| 5 | style="border-bottom-style: none; text-align: center" | <code>*</code> | style="border-bottom-style: none" | Multiplication | style="vertical-align: top" rowspan="3" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/</code> | style="border-bottom-style: none; border-top-style: none" | Division |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%</code> | style="border-bottom-style: none; border-top-style: none" | Modulo (remainder) |- ! rowspan=2| 6 | style="border-bottom-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none" | Addition | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Subtraction |- ! rowspan=2| 7 | style="border-bottom-style: none; text-align: center" | <code>&lt;&lt;</code> | style="border-bottom-style: none" | Bitwise left shift | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise right shift |- ! rowspan=6| 8 | style="border-bottom-style: none; text-align: center" | <code>&lt;</code> | style="border-bottom-style: none" | Less than | style="vertical-align: top" rowspan="6" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Less than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Greater than |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Greater than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Select greater value (maximum) |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&lt;</code> | style="border-bottom-style: none; border-top-style: none" | Select smaller value (minimum) |- ! rowspan=2| 9 | style="border-bottom-style: none; text-align: center" | <code>==</code> | style="border-bottom-style: none" | Equal to | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!=</code> | style="border-bottom-style: none; border-top-style: none" | Not equal to |- ! 10 | style="text-align: center" |<code>&amp;</code> | Bitwise AND | Left-to-right |- ! 11 | style="text-align: center" |<code>^</code> | Bitwise XOR (exclusive or) | Left-to-right |- ! 12 | style="text-align: center" |<code><nowiki>|</nowiki></code> | Bitwise OR (inclusive or) | Left-to-right |- ! 13 | style="text-align: center" |<code>&amp;&amp;</code> | Logical AND | Left-to-right |- ! 14 | style="text-align: center" |<code><nowiki>||</nowiki></code> | Logical OR | Left-to-right |- ! 15 | style="border-bottom-style: none; text-align: center" | <code>?:</code> | style="border-bottom-style: none" | Ternary conditional | Right-to-left |- ! rowspan=11| 16 | style="border-bottom-style: none; text-align: center" | <code>=</code> | style="border-bottom-style: none" | Direct assignment | style="vertical-align: top" rowspan="11" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by sum |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by difference |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>*=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by product |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by quotient |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by remainder |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise left shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise right shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&amp;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise AND |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>^=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise XOR |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code><nowiki>|</nowiki>=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise OR |- ! 18 <small>lowest</small> | style="text-align: center" |<code>,</code> | Expression list (executes in sequence, returns value of the last) | Left-to-right |} === Evaluator functions === Following functions are available within evaluator expressions. {| class="wikitable" ! Function name ! Description |- |acos( ''x'' ) |Arcus cosinus |- |addbyte( ''sec'', ''b'' ) |Add byte ''b'' to section ''sec'' |- |asin( ''x'' ) |Arcus sinus |- |ceil( ''x'' ) |Round up to nearest integer |- |clamp( ''x'', ''min'', ''max'' ) |Clamp ''x'' to range ''min'' to ''max'' |- |color( ''r'', ''g'', ''b'' ) |Return palette index for nearest color to color (''r'',''g'',''b'') |- |color( ''x'' ) |Return palette index for nearest color specified in format ''0xRRGGBB'' |- |cos( ''x'' ) |Cosinus |- |error( ''err'' ) |Print error message ''err'' ane terminate compilation |- |floor( ''x'' ) |Round down to nearest integer |- |frac( ''x'' ) |Get fractional part ( ''x-floor(x)'' ) |- |index( ''tab'', ''x'' ) |1-dimensional indexing operator ( same as ''tab''[''x''] ) |- |index( ''tab'', ''x'', ''y'' ) |2-dimensional indexing operator ( same as ''tab''[''x'',''y''] ) |- |max( ''a'', ''b'' ) |Maximum |- |min( ''a'', ''b'' ) |Minimum |- |pow( ''x'', ''y'' ) |Power function |- |print( ''msg'' ) |Print message ''msg'' |- |rnd( ) |Random value ''0 <= x < 1'' |- |round( ''x'' ) |Round to nearest integer |- |sin( ''x'' ) |Sinus |- |size( ''sec'' ) |Current size of section ''sec'' |- |sqrt( ''x'' ) |Square root |- |} 35bc42f04285625367b7c32365181ea12aeec28e 61 53 2014-12-21T02:20:34Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] __FORCETOC__ Evaluator in '''[[K65]]''' is compile-time executed expression language very similar to C/C++ expressions. === Evaluator operators === Available operators and their precedence levels are similar to [[wikipedia:Operators_in_C_and_C++#Operator_precedence|operators in C and C++]] {| class="wikitable" |- ! style="text-align: left" | Precedence ! style="text-align: left" | Operator ! style="text-align: left" | Description ! style="text-align: left" | Associativity |- ! rowspan=5| 2 <small>highest</small> | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Suffix increment | style="vertical-align: top" rowspan="5" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Suffix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>()</code> | style="border-bottom-style: none; border-top-style: none" | Function call |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>[]</code> | style="border-bottom-style: none; border-top-style: none" | Array subscripting |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>.</code> | style="border-bottom-style: none; border-top-style: none" | Single argument function call |- ! rowspan=6| 3 | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Prefix increment | style="vertical-align: top" rowspan="6" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Prefix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none; border-top-style: none" | Unary plus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Unary minus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!</code> | style="border-bottom-style: none; border-top-style: none" | Logical NOT |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>~</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise NOT (One's Complement) |- ! rowspan=3| 5 | style="border-bottom-style: none; text-align: center" | <code>*</code> | style="border-bottom-style: none" | Multiplication | style="vertical-align: top" rowspan="3" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/</code> | style="border-bottom-style: none; border-top-style: none" | Division |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%</code> | style="border-bottom-style: none; border-top-style: none" | Modulo (remainder) |- ! rowspan=2| 6 | style="border-bottom-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none" | Addition | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Subtraction |- ! rowspan=2| 7 | style="border-bottom-style: none; text-align: center" | <code>&lt;&lt;</code> | style="border-bottom-style: none" | Bitwise left shift | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise right shift |- ! rowspan=6| 8 | style="border-bottom-style: none; text-align: center" | <code>&lt;</code> | style="border-bottom-style: none" | Less than | style="vertical-align: top" rowspan="6" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Less than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Greater than |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Greater than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Select greater value (maximum) |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&lt;</code> | style="border-bottom-style: none; border-top-style: none" | Select smaller value (minimum) |- ! rowspan=2| 9 | style="border-bottom-style: none; text-align: center" | <code>==</code> | style="border-bottom-style: none" | Equal to | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!=</code> | style="border-bottom-style: none; border-top-style: none" | Not equal to |- ! 10 | style="text-align: center" |<code>&amp;</code> | Bitwise AND | Left-to-right |- ! 11 | style="text-align: center" |<code>^</code> | Bitwise XOR (exclusive or) | Left-to-right |- ! 12 | style="text-align: center" |<code><nowiki>|</nowiki></code> | Bitwise OR (inclusive or) | Left-to-right |- ! 13 | style="text-align: center" |<code>&amp;&amp;</code> | Logical AND | Left-to-right |- ! 14 | style="text-align: center" |<code><nowiki>||</nowiki></code> | Logical OR | Left-to-right |- ! 15 | style="border-bottom-style: none; text-align: center" | <code>?:</code> | style="border-bottom-style: none" | Ternary conditional | Right-to-left |- ! rowspan=11| 16 | style="border-bottom-style: none; text-align: center" | <code>=</code> | style="border-bottom-style: none" | Direct assignment | style="vertical-align: top" rowspan="11" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by sum |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by difference |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>*=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by product |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by quotient |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by remainder |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise left shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise right shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&amp;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise AND |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>^=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise XOR |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code><nowiki>|</nowiki>=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise OR |- ! 18 <small>lowest</small> | style="text-align: center" |<code>,</code> | Expression list (executes in sequence, returns value of the last) | Left-to-right |} === Evaluator functions === Following functions are available within evaluator expressions. {| class="wikitable" ! Function name ! Description |- |acos( ''x'' ) |Arcus cosinus |- |addbyte( ''sec'', ''b'' ) |Add byte ''b'' to section ''sec'' |- |asin( ''x'' ) |Arcus sinus |- |ceil( ''x'' ) |Round up to nearest integer |- |clamp( ''x'', ''min'', ''max'' ) |Clamp ''x'' to range ''min'' to ''max'' |- |color( ''r'', ''g'', ''b'' ) |Return palette index for nearest color to color (''r'',''g'',''b'') |- |color( ''x'' ) |Return palette index for nearest color specified in format ''0xRRGGBB'' |- |cos( ''x'' ) |Cosinus |- |error( ''err'' ) |Print error message ''err'' ane terminate compilation |- |floor( ''x'' ) |Round down to nearest integer |- |frac( ''x'' ) |Get fractional part ( ''x-floor(x)'' ) |- |index( ''tab'', ''x'' ) |1-dimensional indexing operator ( same as ''tab''[''x''] ) |- |index( ''tab'', ''x'', ''y'' ) |2-dimensional indexing operator ( same as ''tab''[''x'',''y''] ) |- |max( ''a'', ''b'' ) |Maximum |- |min( ''a'', ''b'' ) |Minimum |- |pow( ''x'', ''y'' ) |Power function |- |print( ''msg'' ) |Print message ''msg'' |- |rnd( ) |Random value ''0 <= x < 1'' |- |round( ''x'' ) |Round to nearest integer |- |sin( ''x'' ) |Sinus |- |size( ''sec'' ) |Current size of section ''sec'' |- |sqrt( ''x'' ) |Square root |- |} e366c3accbbdc67ef1077eac14be9ec0cc12e5dd 53 52 2014-12-19T23:04:19Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] __FORCETOC__ Evaluator in [[K65]] is compile-time executed expression language very similar to C/C++ expressions. === Evaluator operators === Available operators and their precedence levels are similar to [[wikipedia:Operators_in_C_and_C++#Operator_precedence|operators in C and C++]] {| class="wikitable" |- ! style="text-align: left" | Precedence ! style="text-align: left" | Operator ! style="text-align: left" | Description ! style="text-align: left" | Associativity |- ! rowspan=5| 2 <small>highest</small> | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Suffix increment | style="vertical-align: top" rowspan="5" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Suffix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>()</code> | style="border-bottom-style: none; border-top-style: none" | Function call |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>[]</code> | style="border-bottom-style: none; border-top-style: none" | Array subscripting |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>.</code> | style="border-bottom-style: none; border-top-style: none" | Single argument function call |- ! rowspan=6| 3 | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Prefix increment | style="vertical-align: top" rowspan="6" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Prefix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none; border-top-style: none" | Unary plus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Unary minus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!</code> | style="border-bottom-style: none; border-top-style: none" | Logical NOT |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>~</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise NOT (One's Complement) |- ! rowspan=3| 5 | style="border-bottom-style: none; text-align: center" | <code>*</code> | style="border-bottom-style: none" | Multiplication | style="vertical-align: top" rowspan="3" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/</code> | style="border-bottom-style: none; border-top-style: none" | Division |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%</code> | style="border-bottom-style: none; border-top-style: none" | Modulo (remainder) |- ! rowspan=2| 6 | style="border-bottom-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none" | Addition | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Subtraction |- ! rowspan=2| 7 | style="border-bottom-style: none; text-align: center" | <code>&lt;&lt;</code> | style="border-bottom-style: none" | Bitwise left shift | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise right shift |- ! rowspan=6| 8 | style="border-bottom-style: none; text-align: center" | <code>&lt;</code> | style="border-bottom-style: none" | Less than | style="vertical-align: top" rowspan="6" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Less than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Greater than |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Greater than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Select greater value (maximum) |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&lt;</code> | style="border-bottom-style: none; border-top-style: none" | Select smaller value (minimum) |- ! rowspan=2| 9 | style="border-bottom-style: none; text-align: center" | <code>==</code> | style="border-bottom-style: none" | Equal to | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!=</code> | style="border-bottom-style: none; border-top-style: none" | Not equal to |- ! 10 | style="text-align: center" |<code>&amp;</code> | Bitwise AND | Left-to-right |- ! 11 | style="text-align: center" |<code>^</code> | Bitwise XOR (exclusive or) | Left-to-right |- ! 12 | style="text-align: center" |<code><nowiki>|</nowiki></code> | Bitwise OR (inclusive or) | Left-to-right |- ! 13 | style="text-align: center" |<code>&amp;&amp;</code> | Logical AND | Left-to-right |- ! 14 | style="text-align: center" |<code><nowiki>||</nowiki></code> | Logical OR | Left-to-right |- ! 15 | style="border-bottom-style: none; text-align: center" | <code>?:</code> | style="border-bottom-style: none" | Ternary conditional | Right-to-left |- ! rowspan=11| 16 | style="border-bottom-style: none; text-align: center" | <code>=</code> | style="border-bottom-style: none" | Direct assignment | style="vertical-align: top" rowspan="11" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by sum |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by difference |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>*=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by product |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by quotient |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by remainder |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise left shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise right shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&amp;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise AND |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>^=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise XOR |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code><nowiki>|</nowiki>=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise OR |- ! 18 <small>lowest</small> | style="text-align: center" |<code>,</code> | Expression list (executes in sequence, returns value of the last) | Left-to-right |} === Evaluator functions === Following functions are available within evaluator expressions. {| class="wikitable" ! Function name ! Description |- |acos( ''x'' ) |Arcus cosinus |- |addbyte( ''sec'', ''b'' ) |Add byte ''b'' to section ''sec'' |- |asin( ''x'' ) |Arcus sinus |- |ceil( ''x'' ) |Round up to nearest integer |- |clamp( ''x'', ''min'', ''max'' ) |Clamp ''x'' to range ''min'' to ''max'' |- |color( ''r'', ''g'', ''b'' ) |Return palette index for nearest color to color (''r'',''g'',''b'') |- |color( ''x'' ) |Return palette index for nearest color specified in format ''0xRRGGBB'' |- |cos( ''x'' ) |Cosinus |- |error( ''err'' ) |Print error message ''err'' ane terminate compilation |- |floor( ''x'' ) |Round down to nearest integer |- |frac( ''x'' ) |Get fractional part ( ''x-floor(x)'' ) |- |index( ''tab'', ''x'' ) |1-dimensional indexing operator ( same as ''tab''[''x''] ) |- |index( ''tab'', ''x'', ''y'' ) |2-dimensional indexing operator ( same as ''tab''[''x'',''y''] ) |- |max( ''a'', ''b'' ) |Maximum |- |min( ''a'', ''b'' ) |Minimum |- |pow( ''x'', ''y'' ) |Power function |- |print( ''msg'' ) |Print message ''msg'' |- |rnd( ) |Random value ''0 <= x < 1'' |- |round( ''x'' ) |Round to nearest integer |- |sin( ''x'' ) |Sinus |- |size( ''sec'' ) |Current size of section ''sec'' |- |sqrt( ''x'' ) |Square root |- |} 0213e0a8c91ecc6a9e70d0393ce55f8cbcbadfc0 52 51 2014-12-19T23:03:48Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] __FORCETOC__ Evaluator in K65 is compile-time executed expression language very similar to C/C++ expressions. === Evaluator operators === Available operators and their precedence levels are similar to [[wikipedia:Operators_in_C_and_C++#Operator_precedence|operators in C and C++]] {| class="wikitable" |- ! style="text-align: left" | Precedence ! style="text-align: left" | Operator ! style="text-align: left" | Description ! style="text-align: left" | Associativity |- ! rowspan=5| 2 <small>highest</small> | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Suffix increment | style="vertical-align: top" rowspan="5" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Suffix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>()</code> | style="border-bottom-style: none; border-top-style: none" | Function call |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>[]</code> | style="border-bottom-style: none; border-top-style: none" | Array subscripting |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>.</code> | style="border-bottom-style: none; border-top-style: none" | Single argument function call |- ! rowspan=6| 3 | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Prefix increment | style="vertical-align: top" rowspan="6" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Prefix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none; border-top-style: none" | Unary plus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Unary minus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!</code> | style="border-bottom-style: none; border-top-style: none" | Logical NOT |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>~</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise NOT (One's Complement) |- ! rowspan=3| 5 | style="border-bottom-style: none; text-align: center" | <code>*</code> | style="border-bottom-style: none" | Multiplication | style="vertical-align: top" rowspan="3" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/</code> | style="border-bottom-style: none; border-top-style: none" | Division |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%</code> | style="border-bottom-style: none; border-top-style: none" | Modulo (remainder) |- ! rowspan=2| 6 | style="border-bottom-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none" | Addition | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Subtraction |- ! rowspan=2| 7 | style="border-bottom-style: none; text-align: center" | <code>&lt;&lt;</code> | style="border-bottom-style: none" | Bitwise left shift | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise right shift |- ! rowspan=6| 8 | style="border-bottom-style: none; text-align: center" | <code>&lt;</code> | style="border-bottom-style: none" | Less than | style="vertical-align: top" rowspan="6" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Less than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Greater than |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Greater than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Select greater value (maximum) |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&lt;</code> | style="border-bottom-style: none; border-top-style: none" | Select smaller value (minimum) |- ! rowspan=2| 9 | style="border-bottom-style: none; text-align: center" | <code>==</code> | style="border-bottom-style: none" | Equal to | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!=</code> | style="border-bottom-style: none; border-top-style: none" | Not equal to |- ! 10 | style="text-align: center" |<code>&amp;</code> | Bitwise AND | Left-to-right |- ! 11 | style="text-align: center" |<code>^</code> | Bitwise XOR (exclusive or) | Left-to-right |- ! 12 | style="text-align: center" |<code><nowiki>|</nowiki></code> | Bitwise OR (inclusive or) | Left-to-right |- ! 13 | style="text-align: center" |<code>&amp;&amp;</code> | Logical AND | Left-to-right |- ! 14 | style="text-align: center" |<code><nowiki>||</nowiki></code> | Logical OR | Left-to-right |- ! 15 | style="border-bottom-style: none; text-align: center" | <code>?:</code> | style="border-bottom-style: none" | Ternary conditional | Right-to-left |- ! rowspan=11| 16 | style="border-bottom-style: none; text-align: center" | <code>=</code> | style="border-bottom-style: none" | Direct assignment | style="vertical-align: top" rowspan="11" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by sum |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by difference |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>*=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by product |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by quotient |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by remainder |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise left shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise right shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&amp;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise AND |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>^=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise XOR |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code><nowiki>|</nowiki>=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise OR |- ! 18 <small>lowest</small> | style="text-align: center" |<code>,</code> | Expression list (executes in sequence, returns value of the last) | Left-to-right |} === Evaluator functions === Following functions are available within evaluator expressions. {| class="wikitable" ! Function name ! Description |- |acos( ''x'' ) |Arcus cosinus |- |addbyte( ''sec'', ''b'' ) |Add byte ''b'' to section ''sec'' |- |asin( ''x'' ) |Arcus sinus |- |ceil( ''x'' ) |Round up to nearest integer |- |clamp( ''x'', ''min'', ''max'' ) |Clamp ''x'' to range ''min'' to ''max'' |- |color( ''r'', ''g'', ''b'' ) |Return palette index for nearest color to color (''r'',''g'',''b'') |- |color( ''x'' ) |Return palette index for nearest color specified in format ''0xRRGGBB'' |- |cos( ''x'' ) |Cosinus |- |error( ''err'' ) |Print error message ''err'' ane terminate compilation |- |floor( ''x'' ) |Round down to nearest integer |- |frac( ''x'' ) |Get fractional part ( ''x-floor(x)'' ) |- |index( ''tab'', ''x'' ) |1-dimensional indexing operator ( same as ''tab''[''x''] ) |- |index( ''tab'', ''x'', ''y'' ) |2-dimensional indexing operator ( same as ''tab''[''x'',''y''] ) |- |max( ''a'', ''b'' ) |Maximum |- |min( ''a'', ''b'' ) |Minimum |- |pow( ''x'', ''y'' ) |Power function |- |print( ''msg'' ) |Print message ''msg'' |- |rnd( ) |Random value ''0 <= x < 1'' |- |round( ''x'' ) |Round to nearest integer |- |sin( ''x'' ) |Sinus |- |size( ''sec'' ) |Current size of section ''sec'' |- |sqrt( ''x'' ) |Square root |- |} e63b12ff7cfc9a78415e87ed21f83b49a16d716c 51 50 2014-12-19T22:19:18Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] Evaluator in K65 is compile-time executed expression language very similar to C/C++ expressions. === Evaluator operators === Available operators and their precedence levels are similar to [[wikipedia:Operators_in_C_and_C++#Operator_precedence|operators in C and C++]] {| class="wikitable" |- ! style="text-align: left" | Precedence ! style="text-align: left" | Operator ! style="text-align: left" | Description ! style="text-align: left" | Associativity |- ! rowspan=5| 2 <small>highest</small> | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Suffix increment | style="vertical-align: top" rowspan="5" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Suffix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>()</code> | style="border-bottom-style: none; border-top-style: none" | Function call |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>[]</code> | style="border-bottom-style: none; border-top-style: none" | Array subscripting |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>.</code> | style="border-bottom-style: none; border-top-style: none" | Single argument function call |- ! rowspan=6| 3 | style="border-bottom-style: none; text-align: center" | <code>++</code> | style="border-bottom-style: none" | Prefix increment | style="vertical-align: top" rowspan="6" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Prefix decrement |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none; border-top-style: none" | Unary plus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Unary minus |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!</code> | style="border-bottom-style: none; border-top-style: none" | Logical NOT |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>~</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise NOT (One's Complement) |- ! rowspan=3| 5 | style="border-bottom-style: none; text-align: center" | <code>*</code> | style="border-bottom-style: none" | Multiplication | style="vertical-align: top" rowspan="3" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/</code> | style="border-bottom-style: none; border-top-style: none" | Division |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%</code> | style="border-bottom-style: none; border-top-style: none" | Modulo (remainder) |- ! rowspan=2| 6 | style="border-bottom-style: none; text-align: center" | <code>+</code> | style="border-bottom-style: none" | Addition | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Subtraction |- ! rowspan=2| 7 | style="border-bottom-style: none; text-align: center" | <code>&lt;&lt;</code> | style="border-bottom-style: none" | Bitwise left shift | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise right shift |- ! rowspan=6| 8 | style="border-bottom-style: none; text-align: center" | <code>&lt;</code> | style="border-bottom-style: none" | Less than | style="vertical-align: top" rowspan="6" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Less than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Greater than |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Greater than or equal to |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Select greater value (maximum) |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>?&lt;</code> | style="border-bottom-style: none; border-top-style: none" | Select smaller value (minimum) |- ! rowspan=2| 9 | style="border-bottom-style: none; text-align: center" | <code>==</code> | style="border-bottom-style: none" | Equal to | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>!=</code> | style="border-bottom-style: none; border-top-style: none" | Not equal to |- ! 10 | style="text-align: center" |<code>&amp;</code> | Bitwise AND | Left-to-right |- ! 11 | style="text-align: center" |<code>^</code> | Bitwise XOR (exclusive or) | Left-to-right |- ! 12 | style="text-align: center" |<code><nowiki>|</nowiki></code> | Bitwise OR (inclusive or) | Left-to-right |- ! 13 | style="text-align: center" |<code>&amp;&amp;</code> | Logical AND | Left-to-right |- ! 14 | style="text-align: center" |<code><nowiki>||</nowiki></code> | Logical OR | Left-to-right |- ! 15 | style="border-bottom-style: none; text-align: center" | <code>?:</code> | style="border-bottom-style: none" | Ternary conditional | Right-to-left |- ! rowspan=11| 16 | style="border-bottom-style: none; text-align: center" | <code>=</code> | style="border-bottom-style: none" | Direct assignment | style="vertical-align: top" rowspan="11" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>+=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by sum |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>-=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by difference |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>*=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by product |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>/=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by quotient |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>%=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by remainder |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&lt;&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise left shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&gt;&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise right shift |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>&amp;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise AND |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code>^=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise XOR |- | style="border-bottom-style: none; border-top-style: none; text-align: center" | <code><nowiki>|</nowiki>=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise OR |- ! 18 <small>lowest</small> | style="text-align: center" |<code>,</code> | Expression list (executes in sequence, returns value of the last) | Left-to-right |} ed9d9127b73f2d270fdf6f383083587e74d4818a 50 47 2014-12-19T22:14:06Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] Evaluator in K65 is compile-time executed expression language very similar to C/C++ expressions. === Evaluator operators === Available operators and their precedence levels are similar to [[wikipedia:Operators_in_C_and_C++#Operator_precedence|operators in C and C++]] {| class="wikitable" style="text-align: center" |- ! style="text-align: left" | Precedence ! style="text-align: left" | Operator ! style="text-align: left" | Description ! style="text-align: left" | Associativity |- ! rowspan=5| 2 <small>highest</small> | style="border-bottom-style: none" | <code>++</code> | style="border-bottom-style: none" | Suffix increment | style="vertical-align: top" rowspan="5" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Suffix decrement |- | style="border-bottom-style: none; border-top-style: none" | <code>()</code> | style="border-bottom-style: none; border-top-style: none" | Function call |- | style="border-bottom-style: none; border-top-style: none" | <code>[]</code> | style="border-bottom-style: none; border-top-style: none" | Array subscripting |- | style="border-bottom-style: none; border-top-style: none" | <code>.</code> | style="border-bottom-style: none; border-top-style: none" | Single argument function call |- ! rowspan=6| 3 | style="border-bottom-style: none" | <code>++</code> | style="border-bottom-style: none" | Prefix increment | style="vertical-align: top" rowspan="6" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Prefix decrement |- | style="border-bottom-style: none; border-top-style: none" | <code>+</code> | style="border-bottom-style: none; border-top-style: none" | Unary plus |- | style="border-bottom-style: none; border-top-style: none" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Unary minus |- | style="border-bottom-style: none; border-top-style: none" | <code>!</code> | style="border-bottom-style: none; border-top-style: none" | Logical NOT |- | style="border-bottom-style: none; border-top-style: none" | <code>~</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise NOT (One's Complement) |- ! rowspan=3| 5 | style="border-bottom-style: none" | <code>*</code> | style="border-bottom-style: none" | Multiplication | style="vertical-align: top" rowspan="3" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>/</code> | style="border-bottom-style: none; border-top-style: none" | Division |- | style="border-bottom-style: none; border-top-style: none" | <code>%</code> | style="border-bottom-style: none; border-top-style: none" | Modulo (remainder) |- ! rowspan=2| 6 | style="border-bottom-style: none" | <code>+</code> | style="border-bottom-style: none" | Addition | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Subtraction |- ! rowspan=2| 7 | style="border-bottom-style: none" | <code>&lt;&lt;</code> | style="border-bottom-style: none" | Bitwise left shift | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>&gt;&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise right shift |- ! rowspan=6| 8 | style="border-bottom-style: none" | <code>&lt;</code> | style="border-bottom-style: none" | Less than | style="vertical-align: top" rowspan="6" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Less than or equal to |- | style="border-bottom-style: none; border-top-style: none" | <code>&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Greater than |- | style="border-bottom-style: none; border-top-style: none" | <code>&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Greater than or equal to |- | style="border-bottom-style: none; border-top-style: none" | <code>?&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Select greater value (maximum) |- | style="border-bottom-style: none; border-top-style: none" | <code>?&lt;</code> | style="border-bottom-style: none; border-top-style: none" | Select smaller value (minimum) |- ! rowspan=2| 9 | style="border-bottom-style: none" | <code>==</code> | style="border-bottom-style: none" | Equal to | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>!=</code> | style="border-bottom-style: none; border-top-style: none" | Not equal to |- ! 10 | <code>&amp;</code> | Bitwise AND | Left-to-right |- ! 11 | <code>^</code> | Bitwise XOR (exclusive or) | Left-to-right |- ! 12 | <code><nowiki>|</nowiki></code> | Bitwise OR (inclusive or) | Left-to-right |- ! 13 | <code>&amp;&amp;</code> | Logical AND | Left-to-right |- ! 14 | <code><nowiki>||</nowiki></code> | Logical OR | Left-to-right |- ! 15 | style="border-bottom-style: none" | <code>?:</code> | style="border-bottom-style: none" | Ternary conditional | Right-to-left |- ! rowspan=11| 16 | style="border-bottom-style: none" | <code>=</code> | style="border-bottom-style: none" | Direct assignment | style="vertical-align: top" rowspan="11" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none" | <code>+=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by sum |- | style="border-bottom-style: none; border-top-style: none" | <code>-=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by difference |- | style="border-bottom-style: none; border-top-style: none" | <code>*=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by product |- | style="border-bottom-style: none; border-top-style: none" | <code>/=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by quotient |- | style="border-bottom-style: none; border-top-style: none" | <code>%=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by remainder |- | style="border-bottom-style: none; border-top-style: none" | <code>&lt;&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise left shift |- | style="border-bottom-style: none; border-top-style: none" | <code>&gt;&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise right shift |- | style="border-bottom-style: none; border-top-style: none" | <code>&amp;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise AND |- | style="border-bottom-style: none; border-top-style: none" | <code>^=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise XOR |- | style="border-bottom-style: none; border-top-style: none" | <code><nowiki>|</nowiki>=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise OR |- ! 18 <small>lowest</small> | <code>,</code> | Expression list (executes in sequence, returns value of the last) | Left-to-right |} 6df0103047749b43e06cb0c3a4c3038988ca0ecd 47 2014-12-19T22:11:42Z Krzysiek 1 Created page with "[[Category:K65]] Evaluator in K65 is compile-time executed expression language very similar to C/C++ expressions. === Evaluator operators === Available operators and their pr..." wikitext text/x-wiki [[Category:K65]] Evaluator in K65 is compile-time executed expression language very similar to C/C++ expressions. === Evaluator operators === Available operators and their precedence levels are similar to [[wikipedia:Operators_in_C_and_C++#Operator_precedence|operators in C and C++]] {| class="wikitable" |- ! style="text-align: left" | Precedence ! style="text-align: left" | Operator ! style="text-align: left" | Description ! style="text-align: left" | Associativity |- ! rowspan=5| 2 <small>highest</small> | style="border-bottom-style: none" | <code>++</code> | style="border-bottom-style: none" | Suffix increment | style="vertical-align: top" rowspan="5" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Suffix decrement |- | style="border-bottom-style: none; border-top-style: none" | <code>()</code> | style="border-bottom-style: none; border-top-style: none" | Function call |- | style="border-bottom-style: none; border-top-style: none" | <code>[]</code> | style="border-bottom-style: none; border-top-style: none" | Array subscripting |- | style="border-bottom-style: none; border-top-style: none" | <code>.</code> | style="border-bottom-style: none; border-top-style: none" | Single argument function call |- ! rowspan=6| 3 | style="border-bottom-style: none" | <code>++</code> | style="border-bottom-style: none" | Prefix increment | style="vertical-align: top" rowspan="6" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none" | <code>--</code> | style="border-bottom-style: none; border-top-style: none" | Prefix decrement |- | style="border-bottom-style: none; border-top-style: none" | <code>+</code> | style="border-bottom-style: none; border-top-style: none" | Unary plus |- | style="border-bottom-style: none; border-top-style: none" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Unary minus |- | style="border-bottom-style: none; border-top-style: none" | <code>!</code> | style="border-bottom-style: none; border-top-style: none" | Logical NOT |- | style="border-bottom-style: none; border-top-style: none" | <code>~</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise NOT (One's Complement) |- ! rowspan=3| 5 | style="border-bottom-style: none" | <code>*</code> | style="border-bottom-style: none" | Multiplication | style="vertical-align: top" rowspan="3" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>/</code> | style="border-bottom-style: none; border-top-style: none" | Division |- | style="border-bottom-style: none; border-top-style: none" | <code>%</code> | style="border-bottom-style: none; border-top-style: none" | Modulo (remainder) |- ! rowspan=2| 6 | style="border-bottom-style: none" | <code>+</code> | style="border-bottom-style: none" | Addition | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>-</code> | style="border-bottom-style: none; border-top-style: none" | Subtraction |- ! rowspan=2| 7 | style="border-bottom-style: none" | <code>&lt;&lt;</code> | style="border-bottom-style: none" | Bitwise left shift | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>&gt;&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Bitwise right shift |- ! rowspan=6| 8 | style="border-bottom-style: none" | <code>&lt;</code> | style="border-bottom-style: none" | Less than | style="vertical-align: top" rowspan="6" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Less than or equal to |- | style="border-bottom-style: none; border-top-style: none" | <code>&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Greater than |- | style="border-bottom-style: none; border-top-style: none" | <code>&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Greater than or equal to |- | style="border-bottom-style: none; border-top-style: none" | <code>?&gt;</code> | style="border-bottom-style: none; border-top-style: none" | Select greater value (maximum) |- | style="border-bottom-style: none; border-top-style: none" | <code>?&lt;</code> | style="border-bottom-style: none; border-top-style: none" | Select smaller value (minimum) |- ! rowspan=2| 9 | style="border-bottom-style: none" | <code>==</code> | style="border-bottom-style: none" | Equal to | style="vertical-align: top" rowspan="2" | Left-to-right |- | style="border-bottom-style: none; border-top-style: none" | <code>!=</code> | style="border-bottom-style: none; border-top-style: none" | Not equal to |- ! 10 | <code>&amp;</code> | Bitwise AND | Left-to-right |- ! 11 | <code>^</code> | Bitwise XOR (exclusive or) | Left-to-right |- ! 12 | <code><nowiki>|</nowiki></code> | Bitwise OR (inclusive or) | Left-to-right |- ! 13 | <code>&amp;&amp;</code> | Logical AND | Left-to-right |- ! 14 | <code><nowiki>||</nowiki></code> | Logical OR | Left-to-right |- ! 15 | style="border-bottom-style: none" | <code>?:</code> | style="border-bottom-style: none" | Ternary conditional | Right-to-left |- ! rowspan=11| 16 | style="border-bottom-style: none" | <code>=</code> | style="border-bottom-style: none" | Direct assignment | style="vertical-align: top" rowspan="11" | Right-to-left |- | style="border-bottom-style: none; border-top-style: none" | <code>+=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by sum |- | style="border-bottom-style: none; border-top-style: none" | <code>-=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by difference |- | style="border-bottom-style: none; border-top-style: none" | <code>*=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by product |- | style="border-bottom-style: none; border-top-style: none" | <code>/=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by quotient |- | style="border-bottom-style: none; border-top-style: none" | <code>%=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by remainder |- | style="border-bottom-style: none; border-top-style: none" | <code>&lt;&lt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise left shift |- | style="border-bottom-style: none; border-top-style: none" | <code>&gt;&gt;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise right shift |- | style="border-bottom-style: none; border-top-style: none" | <code>&amp;=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise AND |- | style="border-bottom-style: none; border-top-style: none" | <code>^=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise XOR |- | style="border-bottom-style: none; border-top-style: none" | <code><nowiki>|</nowiki>=</code> | style="border-bottom-style: none; border-top-style: none" | Assignment by bitwise OR |- ! 18 <small>lowest</small> | <code>,</code> | Expression list (executes in sequence, returns value of the last) | Left-to-right |} 07c3d58f2677fb59737abaf765504bf4247d9fc5 K65 Instructions 0 2 86 77 2016-07-12T07:06:50Z Krzysiek 1 Fixed BIT instruction wikitext text/x-wiki [[Category:K65]] __FORCETOC__ '''[[K65]]''' compiler supports following 6502 instructions. ''TBD'' value means that instruction support is planned, but currently not implemented. === Standard 6502 instructions === {| class="wikitable" style="text-align: center;" ! colspan="11" | Standard 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ADC || style="text-align: left;" | &nbsp;add with carry || || || a+imm || a+mem || a+mem,x || a+mem,y || a+(mem,x) || a+(mem),y || |- | AND || style="text-align: left;" | &nbsp;and (with accumulator) || || || a&imm || a&mem || a&mem,x || a&mem,y || a&(mem,x) || a&(mem),y || |- | ASL || style="text-align: left;" | &nbsp;arithmetic shift left || a<< || || || mem<< || mem,x<< || || || || |- | BCC || style="text-align: left;" | &nbsp;branch on carry clear || colspan="9" | >={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; < goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } < &nbsp;&nbsp;''or''&nbsp;&nbsp; c+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c- |- | BCS || style="text-align: left;" | &nbsp;branch on carry set || colspan="9" | <{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >= &nbsp;&nbsp;''or''&nbsp;&nbsp; c-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c+ |- | BEQ || style="text-align: left;" | &nbsp;branch on equal (zero set) || colspan="9" | { ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; == goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } == |- | BIT || style="text-align: left;" | &nbsp;bit test || || || || a&?mem || || || || || |- | BMI || style="text-align: left;" | &nbsp;branch on minus (negative set) || colspan="9" | >=0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <0 |- | BNE || style="text-align: left;" | &nbsp;branch on not equal (zero clear) || colspan="9" | =={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; != goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } != |- | BPL || style="text-align: left;" | &nbsp;branch on plus (negative clear) || colspan="9" | <0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >=0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >=0 |- | BRK || style="text-align: left;" | &nbsp;interrupt || || ''TBD'' || || || || || || || |- | BVC || style="text-align: left;" | &nbsp;branch on overflow clear || colspan="9" | <<={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >>= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >>= &nbsp;&nbsp;''or''&nbsp;&nbsp; o+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o- |- | BVS || style="text-align: left;" | &nbsp;branch on overflow set || colspan="9" | >>={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <<= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <<= &nbsp;&nbsp;''or''&nbsp;&nbsp; o-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o+ |- | CLC || style="text-align: left;" | &nbsp;clear carry || || c- || || || || || || || |- | CLD || style="text-align: left;" | &nbsp;clear decimal || || d- || || || || || || || |- | CLI || style="text-align: left;" | &nbsp;clear interrupt disable || || i- || || || || || || || |- | CLV || style="text-align: left;" | &nbsp;clear overflow || || o- || || || || || || || |- | CMP || style="text-align: left;" | &nbsp;compare (with accumulator) || || || a?imm || a?mem || a?mem,x || a?mem,y || a?(mem,x) || a?(mem),y || |- | CPX || style="text-align: left;" | &nbsp;compare with X || || || x?imm || x?mem || || || || || |- | CPY || style="text-align: left;" | &nbsp;compare with Y || || || y?imm || y?mem || || || || || |- | DEC || style="text-align: left;" | &nbsp;decrement || || || || mem-- || mem,x-- || || || || |- | DEX || style="text-align: left;" | &nbsp;decrement X || || x-- || || || || || || || |- | DEY || style="text-align: left;" | &nbsp;decrement Y || || y-- || || || || || || || |- | EOR || style="text-align: left;" | &nbsp;exclusive or (with accumulator) || || || a^imm || a^mem || a^mem,x || a^mem,y || a^(mem,x) || a^(mem),y || |- | INC || style="text-align: left;" | &nbsp;increment || || || || mem++ || mem,x++ || || || || |- | INX || style="text-align: left;" | &nbsp;increment X || || x++ || || || || || || || |- | INY || style="text-align: left;" | &nbsp;increment Y || || y++ || || || || || || || |- | JMP || style="text-align: left;" | &nbsp;jump || || || || goto mem || || || || || goto (mem) |- | JSR || style="text-align: left;" | &nbsp;jump subroutine || || || || call mem || || || || || |- | LAS || style="text-align: left;" | &nbsp; || || || || || || || || || |- | LDA || style="text-align: left;" | &nbsp;load accumulator || || || a=imm || a=mem || a=mem,x || a=mem,y || a=(mem,x) || a=(mem),y || |- | LDX || style="text-align: left;" | &nbsp;load X || || || x=imm || x=mem || || x=mem,y || || || |- | LDY || style="text-align: left;" | &nbsp;load Y || || || y=imm || y=mem || y=mem,x || || || || |- | LSR || style="text-align: left;" | &nbsp;logical shift right || a>> || || || mem>> || mem,x>> || || || || |- | NOP || style="text-align: left;" | &nbsp;no operation || colspan="9" | * ''(for single NOP)'' &nbsp;&nbsp;''or''&nbsp;&nbsp; *''<number>'' ''(to wait <number> of cycles)'' |- | ORA || style="text-align: left;" | &nbsp;or with accumulator || || || a|imm || a|mem || a|mem,x || a|mem,y || a|(mem,x) || a|(mem),y || |- | PHA || style="text-align: left;" | &nbsp;push accumulator || || a!! || || || || || || || |- | PHP || style="text-align: left;" | &nbsp;push processor status (SR) || || flag!! || || || || || || || |- | PLA || style="text-align: left;" | &nbsp;pull accumulator || || a?? || || || || || || || |- | PLP || style="text-align: left;" | &nbsp;pull processor status (SR) || || flag?? || || || || || || || |- | ROL || style="text-align: left;" | &nbsp;rotate left || a<<< || || || mem<<< || mem,x<<< || || || || |- | ROR || style="text-align: left;" | &nbsp;rotate right || a>>> || || || mem>>> || mem,x>>> || || || || |- | RRA || style="text-align: left;" | &nbsp; || || || || || || || || || |- | RTI || style="text-align: left;" | &nbsp;return from interrupt || || ''TBD'' || || || || || || || |- | RTS || style="text-align: left;" | &nbsp;return from subroutine || || return || || || || || || || |- | SBC || style="text-align: left;" | &nbsp;subtract with carry || || || a-imm || a-mem || a-mem,x || a-mem,y || a-(mem,x) || a-(mem),y || |- | SEC || style="text-align: left;" | &nbsp;set carry || || c+ || || || || || || || |- | SED || style="text-align: left;" | &nbsp;set decimal || || d+ || || || || || || || |- | SEI || style="text-align: left;" | &nbsp;set interrupt disable || || i- || || || || || || || |- | STA || style="text-align: left;" | &nbsp;store accumulator || || || || mem=a || mem,x=a || mem,y=a || (mem,x)=a || (mem),y=a || |- | STX || style="text-align: left;" | &nbsp;store X || || || || mem=x || || || || || |- | STY || style="text-align: left;" | &nbsp;store Y || || || || mem=y || || || || || |- | TAX || style="text-align: left;" | &nbsp;transfer accumulator to X || || x=a || || || || || || || |- | TAY || style="text-align: left;" | &nbsp;transfer accumulator to Y || || y=a || || || || || || || |- | TSX || style="text-align: left;" | &nbsp;transfer stack pointer to X || || x=s || || || || || || || |- | TXA || style="text-align: left;" | &nbsp;transfer X to accumulator || || a=x || || || || || || || |- | TXS || style="text-align: left;" | &nbsp;transfer X to stack pointer || || s=x || || || || || || || |- | TYA || style="text-align: left;" | &nbsp;transfer Y to accumulator || || a=y || || || || || || || |- |} === Undocumented 6502 instructions === {| class="wikitable" style="text-align: center;" ! colspan="11" | Undocumented 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ANC || style="text-align: left;" | &nbsp;A <- A & imm, C <- bit 7 || || || a&.imm || || || || || || |- | ARR || style="text-align: left;" | &nbsp;A <- (A & imm) ror>>> || || || ''TBD'' || || || || || || |- | ASR || style="text-align: left;" | &nbsp;A <- (A & imm) >> 1 || || || ''TBD'' || || || || || || |- | AXS || style="text-align: left;" | &nbsp;X <- (A & X) - imm &nbsp;&nbsp;(no borrow) || || || x&=a-imm || || || || || || |- | DCP || style="text-align: left;" | &nbsp;decrement mem, then compare Acc to mem || || || || a?--mem || a?--mem,x || a?--mem,y || a?--(mem,x) || a?--(mem),y || |- | ISC || style="text-align: left;" | &nbsp;increment mem, then subtract mem from Acc (with borrow) || || || || a - ++mem || a - ++mem,x || a - ++mem,y || a - ++(mem,x) || a - ++(mem),y || |- | LAX || style="text-align: left;" | &nbsp;load to Acc and X || || || || a=x=mem || || a=x=mem,y || a=x=(mem,x) || a=x=(mem),y || |- | NOP || style="text-align: left;" | &nbsp;NOP with #immediate lasting 3 cycles || colspan="9" | *<number> (with even <number> generates one NOP #imm and regular NOPs) |- | RLA || style="text-align: left;" | &nbsp;mem <- mem <<<, A <- A & mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SAX || style="text-align: left;" | &nbsp;mem = A & X || || || || mem=a&x || || || (mem,x)=a&x || || |- | SLO || style="text-align: left;" | &nbsp;mem <- mem << 1, A <- A | mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SRE || style="text-align: left;" | &nbsp;mem <- mem >> 1, A <- A ^ mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- |} 9479d787425827d2a9902b97a790656d1fedc90f 77 60 2015-06-12T12:41:31Z Krzysiek 1 /* Undocumented 6502 instructions */ wikitext text/x-wiki [[Category:K65]] __FORCETOC__ '''[[K65]]''' compiler supports following 6502 instructions. ''TBD'' value means that instruction support is planned, but currently not implemented. === Standard 6502 instructions === {| class="wikitable" style="text-align: center;" ! colspan="11" | Standard 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ADC || style="text-align: left;" | &nbsp;add with carry || || || a+imm || a+mem || a+mem,x || a+mem,y || a+(mem,x) || a+(mem),y || |- | AND || style="text-align: left;" | &nbsp;and (with accumulator) || || || a&imm || a&mem || a&mem,x || a&mem,y || a&(mem,x) || a&(mem),y || |- | ASL || style="text-align: left;" | &nbsp;arithmetic shift left || a<< || || || mem<< || mem,x<< || || || || |- | BCC || style="text-align: left;" | &nbsp;branch on carry clear || colspan="9" | >={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; < goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } < &nbsp;&nbsp;''or''&nbsp;&nbsp; c+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c- |- | BCS || style="text-align: left;" | &nbsp;branch on carry set || colspan="9" | <{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >= &nbsp;&nbsp;''or''&nbsp;&nbsp; c-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c+ |- | BEQ || style="text-align: left;" | &nbsp;branch on equal (zero set) || colspan="9" | { ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; == goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } == |- | BIT || style="text-align: left;" | &nbsp;bit test || || || || a?mem || || || || || |- | BMI || style="text-align: left;" | &nbsp;branch on minus (negative set) || colspan="9" | >=0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <0 |- | BNE || style="text-align: left;" | &nbsp;branch on not equal (zero clear) || colspan="9" | =={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; != goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } != |- | BPL || style="text-align: left;" | &nbsp;branch on plus (negative clear) || colspan="9" | <0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >=0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >=0 |- | BRK || style="text-align: left;" | &nbsp;interrupt || || ''TBD'' || || || || || || || |- | BVC || style="text-align: left;" | &nbsp;branch on overflow clear || colspan="9" | <<={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >>= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >>= &nbsp;&nbsp;''or''&nbsp;&nbsp; o+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o- |- | BVS || style="text-align: left;" | &nbsp;branch on overflow set || colspan="9" | >>={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <<= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <<= &nbsp;&nbsp;''or''&nbsp;&nbsp; o-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o+ |- | CLC || style="text-align: left;" | &nbsp;clear carry || || c- || || || || || || || |- | CLD || style="text-align: left;" | &nbsp;clear decimal || || d- || || || || || || || |- | CLI || style="text-align: left;" | &nbsp;clear interrupt disable || || i- || || || || || || || |- | CLV || style="text-align: left;" | &nbsp;clear overflow || || o- || || || || || || || |- | CMP || style="text-align: left;" | &nbsp;compare (with accumulator) || || || a?imm || a?mem || a?mem,x || a?mem,y || a?(mem,x) || a?(mem),y || |- | CPX || style="text-align: left;" | &nbsp;compare with X || || || x?imm || x?mem || || || || || |- | CPY || style="text-align: left;" | &nbsp;compare with Y || || || y?imm || y?mem || || || || || |- | DEC || style="text-align: left;" | &nbsp;decrement || || || || mem-- || mem,x-- || || || || |- | DEX || style="text-align: left;" | &nbsp;decrement X || || x-- || || || || || || || |- | DEY || style="text-align: left;" | &nbsp;decrement Y || || y-- || || || || || || || |- | EOR || style="text-align: left;" | &nbsp;exclusive or (with accumulator) || || || a^imm || a^mem || a^mem,x || a^mem,y || a^(mem,x) || a^(mem),y || |- | INC || style="text-align: left;" | &nbsp;increment || || || || mem++ || mem,x++ || || || || |- | INX || style="text-align: left;" | &nbsp;increment X || || x++ || || || || || || || |- | INY || style="text-align: left;" | &nbsp;increment Y || || y++ || || || || || || || |- | JMP || style="text-align: left;" | &nbsp;jump || || || || goto mem || || || || || goto (mem) |- | JSR || style="text-align: left;" | &nbsp;jump subroutine || || || || call mem || || || || || |- | LAS || style="text-align: left;" | &nbsp; || || || || || || || || || |- | LDA || style="text-align: left;" | &nbsp;load accumulator || || || a=imm || a=mem || a=mem,x || a=mem,y || a=(mem,x) || a=(mem),y || |- | LDX || style="text-align: left;" | &nbsp;load X || || || x=imm || x=mem || || x=mem,y || || || |- | LDY || style="text-align: left;" | &nbsp;load Y || || || y=imm || y=mem || y=mem,x || || || || |- | LSR || style="text-align: left;" | &nbsp;logical shift right || a>> || || || mem>> || mem,x>> || || || || |- | NOP || style="text-align: left;" | &nbsp;no operation || colspan="9" | * ''(for single NOP)'' &nbsp;&nbsp;''or''&nbsp;&nbsp; *''<number>'' ''(to wait <number> of cycles)'' |- | ORA || style="text-align: left;" | &nbsp;or with accumulator || || || a|imm || a|mem || a|mem,x || a|mem,y || a|(mem,x) || a|(mem),y || |- | PHA || style="text-align: left;" | &nbsp;push accumulator || || a!! || || || || || || || |- | PHP || style="text-align: left;" | &nbsp;push processor status (SR) || || flag!! || || || || || || || |- | PLA || style="text-align: left;" | &nbsp;pull accumulator || || a?? || || || || || || || |- | PLP || style="text-align: left;" | &nbsp;pull processor status (SR) || || flag?? || || || || || || || |- | ROL || style="text-align: left;" | &nbsp;rotate left || a<<< || || || mem<<< || mem,x<<< || || || || |- | ROR || style="text-align: left;" | &nbsp;rotate right || a>>> || || || mem>>> || mem,x>>> || || || || |- | RRA || style="text-align: left;" | &nbsp; || || || || || || || || || |- | RTI || style="text-align: left;" | &nbsp;return from interrupt || || ''TBD'' || || || || || || || |- | RTS || style="text-align: left;" | &nbsp;return from subroutine || || return || || || || || || || |- | SBC || style="text-align: left;" | &nbsp;subtract with carry || || || a-imm || a-mem || a-mem,x || a-mem,y || a-(mem,x) || a-(mem),y || |- | SEC || style="text-align: left;" | &nbsp;set carry || || c+ || || || || || || || |- | SED || style="text-align: left;" | &nbsp;set decimal || || d+ || || || || || || || |- | SEI || style="text-align: left;" | &nbsp;set interrupt disable || || i- || || || || || || || |- | STA || style="text-align: left;" | &nbsp;store accumulator || || || || mem=a || mem,x=a || mem,y=a || (mem,x)=a || (mem),y=a || |- | STX || style="text-align: left;" | &nbsp;store X || || || || mem=x || || || || || |- | STY || style="text-align: left;" | &nbsp;store Y || || || || mem=y || || || || || |- | TAX || style="text-align: left;" | &nbsp;transfer accumulator to X || || x=a || || || || || || || |- | TAY || style="text-align: left;" | &nbsp;transfer accumulator to Y || || y=a || || || || || || || |- | TSX || style="text-align: left;" | &nbsp;transfer stack pointer to X || || x=s || || || || || || || |- | TXA || style="text-align: left;" | &nbsp;transfer X to accumulator || || a=x || || || || || || || |- | TXS || style="text-align: left;" | &nbsp;transfer X to stack pointer || || s=x || || || || || || || |- | TYA || style="text-align: left;" | &nbsp;transfer Y to accumulator || || a=y || || || || || || || |- |} === Undocumented 6502 instructions === {| class="wikitable" style="text-align: center;" ! colspan="11" | Undocumented 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ANC || style="text-align: left;" | &nbsp;A <- A & imm, C <- bit 7 || || || a&.imm || || || || || || |- | ARR || style="text-align: left;" | &nbsp;A <- (A & imm) ror>>> || || || ''TBD'' || || || || || || |- | ASR || style="text-align: left;" | &nbsp;A <- (A & imm) >> 1 || || || ''TBD'' || || || || || || |- | AXS || style="text-align: left;" | &nbsp;X <- (A & X) - imm &nbsp;&nbsp;(no borrow) || || || x&=a-imm || || || || || || |- | DCP || style="text-align: left;" | &nbsp;decrement mem, then compare Acc to mem || || || || a?--mem || a?--mem,x || a?--mem,y || a?--(mem,x) || a?--(mem),y || |- | ISC || style="text-align: left;" | &nbsp;increment mem, then subtract mem from Acc (with borrow) || || || || a - ++mem || a - ++mem,x || a - ++mem,y || a - ++(mem,x) || a - ++(mem),y || |- | LAX || style="text-align: left;" | &nbsp;load to Acc and X || || || || a=x=mem || || a=x=mem,y || a=x=(mem,x) || a=x=(mem),y || |- | NOP || style="text-align: left;" | &nbsp;NOP with #immediate lasting 3 cycles || colspan="9" | *<number> (with even <number> generates one NOP #imm and regular NOPs) |- | RLA || style="text-align: left;" | &nbsp;mem <- mem <<<, A <- A & mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SAX || style="text-align: left;" | &nbsp;mem = A & X || || || || mem=a&x || || || (mem,x)=a&x || || |- | SLO || style="text-align: left;" | &nbsp;mem <- mem << 1, A <- A | mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SRE || style="text-align: left;" | &nbsp;mem <- mem >> 1, A <- A ^ mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- |} de24a17fa7acda9ac103fc4b02dc987eb94640ae 60 45 2014-12-21T02:20:21Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] __FORCETOC__ '''[[K65]]''' compiler supports following 6502 instructions. ''TBD'' value means that instruction support is planned, but currently not implemented. === Standard 6502 instructions === {| class="wikitable" style="text-align: center;" ! colspan="11" | Standard 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ADC || style="text-align: left;" | &nbsp;add with carry || || || a+imm || a+mem || a+mem,x || a+mem,y || a+(mem,x) || a+(mem),y || |- | AND || style="text-align: left;" | &nbsp;and (with accumulator) || || || a&imm || a&mem || a&mem,x || a&mem,y || a&(mem,x) || a&(mem),y || |- | ASL || style="text-align: left;" | &nbsp;arithmetic shift left || a<< || || || mem<< || mem,x<< || || || || |- | BCC || style="text-align: left;" | &nbsp;branch on carry clear || colspan="9" | >={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; < goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } < &nbsp;&nbsp;''or''&nbsp;&nbsp; c+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c- |- | BCS || style="text-align: left;" | &nbsp;branch on carry set || colspan="9" | <{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >= &nbsp;&nbsp;''or''&nbsp;&nbsp; c-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c+ |- | BEQ || style="text-align: left;" | &nbsp;branch on equal (zero set) || colspan="9" | { ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; == goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } == |- | BIT || style="text-align: left;" | &nbsp;bit test || || || || a?mem || || || || || |- | BMI || style="text-align: left;" | &nbsp;branch on minus (negative set) || colspan="9" | >=0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <0 |- | BNE || style="text-align: left;" | &nbsp;branch on not equal (zero clear) || colspan="9" | =={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; != goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } != |- | BPL || style="text-align: left;" | &nbsp;branch on plus (negative clear) || colspan="9" | <0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >=0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >=0 |- | BRK || style="text-align: left;" | &nbsp;interrupt || || ''TBD'' || || || || || || || |- | BVC || style="text-align: left;" | &nbsp;branch on overflow clear || colspan="9" | <<={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >>= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >>= &nbsp;&nbsp;''or''&nbsp;&nbsp; o+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o- |- | BVS || style="text-align: left;" | &nbsp;branch on overflow set || colspan="9" | >>={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <<= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <<= &nbsp;&nbsp;''or''&nbsp;&nbsp; o-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o+ |- | CLC || style="text-align: left;" | &nbsp;clear carry || || c- || || || || || || || |- | CLD || style="text-align: left;" | &nbsp;clear decimal || || d- || || || || || || || |- | CLI || style="text-align: left;" | &nbsp;clear interrupt disable || || i- || || || || || || || |- | CLV || style="text-align: left;" | &nbsp;clear overflow || || o- || || || || || || || |- | CMP || style="text-align: left;" | &nbsp;compare (with accumulator) || || || a?imm || a?mem || a?mem,x || a?mem,y || a?(mem,x) || a?(mem),y || |- | CPX || style="text-align: left;" | &nbsp;compare with X || || || x?imm || x?mem || || || || || |- | CPY || style="text-align: left;" | &nbsp;compare with Y || || || y?imm || y?mem || || || || || |- | DEC || style="text-align: left;" | &nbsp;decrement || || || || mem-- || mem,x-- || || || || |- | DEX || style="text-align: left;" | &nbsp;decrement X || || x-- || || || || || || || |- | DEY || style="text-align: left;" | &nbsp;decrement Y || || y-- || || || || || || || |- | EOR || style="text-align: left;" | &nbsp;exclusive or (with accumulator) || || || a^imm || a^mem || a^mem,x || a^mem,y || a^(mem,x) || a^(mem),y || |- | INC || style="text-align: left;" | &nbsp;increment || || || || mem++ || mem,x++ || || || || |- | INX || style="text-align: left;" | &nbsp;increment X || || x++ || || || || || || || |- | INY || style="text-align: left;" | &nbsp;increment Y || || y++ || || || || || || || |- | JMP || style="text-align: left;" | &nbsp;jump || || || || goto mem || || || || || goto (mem) |- | JSR || style="text-align: left;" | &nbsp;jump subroutine || || || || call mem || || || || || |- | LAS || style="text-align: left;" | &nbsp; || || || || || || || || || |- | LDA || style="text-align: left;" | &nbsp;load accumulator || || || a=imm || a=mem || a=mem,x || a=mem,y || a=(mem,x) || a=(mem),y || |- | LDX || style="text-align: left;" | &nbsp;load X || || || x=imm || x=mem || || x=mem,y || || || |- | LDY || style="text-align: left;" | &nbsp;load Y || || || y=imm || y=mem || y=mem,x || || || || |- | LSR || style="text-align: left;" | &nbsp;logical shift right || a>> || || || mem>> || mem,x>> || || || || |- | NOP || style="text-align: left;" | &nbsp;no operation || colspan="9" | * ''(for single NOP)'' &nbsp;&nbsp;''or''&nbsp;&nbsp; *''<number>'' ''(to wait <number> of cycles)'' |- | ORA || style="text-align: left;" | &nbsp;or with accumulator || || || a|imm || a|mem || a|mem,x || a|mem,y || a|(mem,x) || a|(mem),y || |- | PHA || style="text-align: left;" | &nbsp;push accumulator || || a!! || || || || || || || |- | PHP || style="text-align: left;" | &nbsp;push processor status (SR) || || flag!! || || || || || || || |- | PLA || style="text-align: left;" | &nbsp;pull accumulator || || a?? || || || || || || || |- | PLP || style="text-align: left;" | &nbsp;pull processor status (SR) || || flag?? || || || || || || || |- | ROL || style="text-align: left;" | &nbsp;rotate left || a<<< || || || mem<<< || mem,x<<< || || || || |- | ROR || style="text-align: left;" | &nbsp;rotate right || a>>> || || || mem>>> || mem,x>>> || || || || |- | RRA || style="text-align: left;" | &nbsp; || || || || || || || || || |- | RTI || style="text-align: left;" | &nbsp;return from interrupt || || ''TBD'' || || || || || || || |- | RTS || style="text-align: left;" | &nbsp;return from subroutine || || return || || || || || || || |- | SBC || style="text-align: left;" | &nbsp;subtract with carry || || || a-imm || a-mem || a-mem,x || a-mem,y || a-(mem,x) || a-(mem),y || |- | SEC || style="text-align: left;" | &nbsp;set carry || || c+ || || || || || || || |- | SED || style="text-align: left;" | &nbsp;set decimal || || d+ || || || || || || || |- | SEI || style="text-align: left;" | &nbsp;set interrupt disable || || i- || || || || || || || |- | STA || style="text-align: left;" | &nbsp;store accumulator || || || || mem=a || mem,x=a || mem,y=a || (mem,x)=a || (mem),y=a || |- | STX || style="text-align: left;" | &nbsp;store X || || || || mem=x || || || || || |- | STY || style="text-align: left;" | &nbsp;store Y || || || || mem=y || || || || || |- | TAX || style="text-align: left;" | &nbsp;transfer accumulator to X || || x=a || || || || || || || |- | TAY || style="text-align: left;" | &nbsp;transfer accumulator to Y || || y=a || || || || || || || |- | TSX || style="text-align: left;" | &nbsp;transfer stack pointer to X || || x=s || || || || || || || |- | TXA || style="text-align: left;" | &nbsp;transfer X to accumulator || || a=x || || || || || || || |- | TXS || style="text-align: left;" | &nbsp;transfer X to stack pointer || || s=x || || || || || || || |- | TYA || style="text-align: left;" | &nbsp;transfer Y to accumulator || || a=y || || || || || || || |- |} === Undocumented 6502 instructions === {| class="wikitable" style="text-align: center;" ! colspan="11" | Undocumented 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ANC || style="text-align: left;" | &nbsp;A <- A & imm, C <- bit 7 || || || a&.imm || || || || || || |- | ARR || style="text-align: left;" | &nbsp;A <- (A & imm) ror>>> || || || ''TBD'' || || || || || || |- | ASR || style="text-align: left;" | &nbsp;A <- (A & imm) >> 1 || || || ''TBD'' || || || || || || |- | AXS || style="text-align: left;" | &nbsp;X <- (A & X) - imm &nbsp;&nbsp;(no borrow) || || || x&=a-imm || || || || || || |- | DCP || style="text-align: left;" | &nbsp;decrement mem, then compare Acc to mem || || || || a?--mem || a?--mem,x || a?--mem,y || a?--(mem,x) || a?--(mem),y || |- | ISC || style="text-align: left;" | &nbsp;increment mem, then subtract mem from Acc (with borrow) || || || || a - ++mem || a - ++mem,x || a - ++mem,y || a - ++(mem,x) || a - ++(mem),y || |- | LAX || style="text-align: left;" | &nbsp;load to Acc and X || || || || a=x=mem || || a=x=mem,y || a=x=(mem,x) || a=x=(mem),y || |- | RLA || style="text-align: left;" | &nbsp;mem <- mem <<<, A <- A & mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SAX || style="text-align: left;" | &nbsp;mem = A & X || || || || mem=a&x || || || (mem,x)=a&x || || |- | SLO || style="text-align: left;" | &nbsp;mem <- mem << 1, A <- A | mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SRE || style="text-align: left;" | &nbsp;mem <- mem >> 1, A <- A ^ mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- |} b6d8ded2cc4f30e67ae84f8ce19622c9fe622fbb 45 37 2014-12-15T22:11:43Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] {| class="wikitable" style="text-align: center;" ! colspan="11" | Standard 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ADC || style="text-align: left;" | &nbsp;add with carry || || || a+imm || a+mem || a+mem,x || a+mem,y || a+(mem,x) || a+(mem),y || |- | AND || style="text-align: left;" | &nbsp;and (with accumulator) || || || a&imm || a&mem || a&mem,x || a&mem,y || a&(mem,x) || a&(mem),y || |- | ASL || style="text-align: left;" | &nbsp;arithmetic shift left || a<< || || || mem<< || mem,x<< || || || || |- | BCC || style="text-align: left;" | &nbsp;branch on carry clear || colspan="9" | >={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; < goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } < &nbsp;&nbsp;''or''&nbsp;&nbsp; c+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c- |- | BCS || style="text-align: left;" | &nbsp;branch on carry set || colspan="9" | <{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >= &nbsp;&nbsp;''or''&nbsp;&nbsp; c-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c+ |- | BEQ || style="text-align: left;" | &nbsp;branch on equal (zero set) || colspan="9" | { ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; == goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } == |- | BIT || style="text-align: left;" | &nbsp;bit test || || || || a?mem || || || || || |- | BMI || style="text-align: left;" | &nbsp;branch on minus (negative set) || colspan="9" | >=0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <0 |- | BNE || style="text-align: left;" | &nbsp;branch on not equal (zero clear) || colspan="9" | =={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; != goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } != |- | BPL || style="text-align: left;" | &nbsp;branch on plus (negative clear) || colspan="9" | <0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >=0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >=0 |- | BRK || style="text-align: left;" | &nbsp;interrupt || || ''TBD'' || || || || || || || |- | BVC || style="text-align: left;" | &nbsp;branch on overflow clear || colspan="9" | <<={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >>= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >>= &nbsp;&nbsp;''or''&nbsp;&nbsp; o+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o- |- | BVS || style="text-align: left;" | &nbsp;branch on overflow set || colspan="9" | >>={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <<= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <<= &nbsp;&nbsp;''or''&nbsp;&nbsp; o-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o+ |- | CLC || style="text-align: left;" | &nbsp;clear carry || || c- || || || || || || || |- | CLD || style="text-align: left;" | &nbsp;clear decimal || || d- || || || || || || || |- | CLI || style="text-align: left;" | &nbsp;clear interrupt disable || || i- || || || || || || || |- | CLV || style="text-align: left;" | &nbsp;clear overflow || || o- || || || || || || || |- | CMP || style="text-align: left;" | &nbsp;compare (with accumulator) || || || a?imm || a?mem || a?mem,x || a?mem,y || a?(mem,x) || a?(mem),y || |- | CPX || style="text-align: left;" | &nbsp;compare with X || || || x?imm || x?mem || || || || || |- | CPY || style="text-align: left;" | &nbsp;compare with Y || || || y?imm || y?mem || || || || || |- | DEC || style="text-align: left;" | &nbsp;decrement || || || || mem-- || mem,x-- || || || || |- | DEX || style="text-align: left;" | &nbsp;decrement X || || x-- || || || || || || || |- | DEY || style="text-align: left;" | &nbsp;decrement Y || || y-- || || || || || || || |- | EOR || style="text-align: left;" | &nbsp;exclusive or (with accumulator) || || || a^imm || a^mem || a^mem,x || a^mem,y || a^(mem,x) || a^(mem),y || |- | INC || style="text-align: left;" | &nbsp;increment || || || || mem++ || mem,x++ || || || || |- | INX || style="text-align: left;" | &nbsp;increment X || || x++ || || || || || || || |- | INY || style="text-align: left;" | &nbsp;increment Y || || y++ || || || || || || || |- | JMP || style="text-align: left;" | &nbsp;jump || || || || goto mem || || || || || goto (mem) |- | JSR || style="text-align: left;" | &nbsp;jump subroutine || || || || call mem || || || || || |- | LAS || style="text-align: left;" | &nbsp; || || || || || || || || || |- | LDA || style="text-align: left;" | &nbsp;load accumulator || || || a=imm || a=mem || a=mem,x || a=mem,y || a=(mem,x) || a=(mem),y || |- | LDX || style="text-align: left;" | &nbsp;load X || || || x=imm || x=mem || || x=mem,y || || || |- | LDY || style="text-align: left;" | &nbsp;load Y || || || y=imm || y=mem || y=mem,x || || || || |- | LSR || style="text-align: left;" | &nbsp;logical shift right || a>> || || || mem>> || mem,x>> || || || || |- | NOP || style="text-align: left;" | &nbsp;no operation || colspan="9" | * ''(for single NOP)'' &nbsp;&nbsp;''or''&nbsp;&nbsp; *''<number>'' ''(to wait <number> of cycles)'' |- | ORA || style="text-align: left;" | &nbsp;or with accumulator || || || a|imm || a|mem || a|mem,x || a|mem,y || a|(mem,x) || a|(mem),y || |- | PHA || style="text-align: left;" | &nbsp;push accumulator || || a!! || || || || || || || |- | PHP || style="text-align: left;" | &nbsp;push processor status (SR) || || flag!! || || || || || || || |- | PLA || style="text-align: left;" | &nbsp;pull accumulator || || a?? || || || || || || || |- | PLP || style="text-align: left;" | &nbsp;pull processor status (SR) || || flag?? || || || || || || || |- | ROL || style="text-align: left;" | &nbsp;rotate left || a<<< || || || mem<<< || mem,x<<< || || || || |- | ROR || style="text-align: left;" | &nbsp;rotate right || a>>> || || || mem>>> || mem,x>>> || || || || |- | RRA || style="text-align: left;" | &nbsp; || || || || || || || || || |- | RTI || style="text-align: left;" | &nbsp;return from interrupt || || ''TBD'' || || || || || || || |- | RTS || style="text-align: left;" | &nbsp;return from subroutine || || return || || || || || || || |- | SBC || style="text-align: left;" | &nbsp;subtract with carry || || || a-imm || a-mem || a-mem,x || a-mem,y || a-(mem,x) || a-(mem),y || |- | SEC || style="text-align: left;" | &nbsp;set carry || || c+ || || || || || || || |- | SED || style="text-align: left;" | &nbsp;set decimal || || d+ || || || || || || || |- | SEI || style="text-align: left;" | &nbsp;set interrupt disable || || i- || || || || || || || |- | STA || style="text-align: left;" | &nbsp;store accumulator || || || || mem=a || mem,x=a || mem,y=a || (mem,x)=a || (mem),y=a || |- | STX || style="text-align: left;" | &nbsp;store X || || || || mem=x || || || || || |- | STY || style="text-align: left;" | &nbsp;store Y || || || || mem=y || || || || || |- | TAX || style="text-align: left;" | &nbsp;transfer accumulator to X || || x=a || || || || || || || |- | TAY || style="text-align: left;" | &nbsp;transfer accumulator to Y || || y=a || || || || || || || |- | TSX || style="text-align: left;" | &nbsp;transfer stack pointer to X || || x=s || || || || || || || |- | TXA || style="text-align: left;" | &nbsp;transfer X to accumulator || || a=x || || || || || || || |- | TXS || style="text-align: left;" | &nbsp;transfer X to stack pointer || || s=x || || || || || || || |- | TYA || style="text-align: left;" | &nbsp;transfer Y to accumulator || || a=y || || || || || || || |- |} {| class="wikitable" style="text-align: center;" ! colspan="11" | Undocumented 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ANC || style="text-align: left;" | &nbsp;A <- A & imm, C <- bit 7 || || || a&.imm || || || || || || |- | ARR || style="text-align: left;" | &nbsp;A <- (A & imm) ror>>> || || || ''TBD'' || || || || || || |- | ASR || style="text-align: left;" | &nbsp;A <- (A & imm) >> 1 || || || ''TBD'' || || || || || || |- | AXS || style="text-align: left;" | &nbsp;X <- (A & X) - imm &nbsp;&nbsp;(no borrow) || || || x&=a-imm || || || || || || |- | DCP || style="text-align: left;" | &nbsp;decrement mem, then compare Acc to mem || || || || a?--mem || a?--mem,x || a?--mem,y || a?--(mem,x) || a?--(mem),y || |- | ISC || style="text-align: left;" | &nbsp;increment mem, then subtract mem from Acc (with borrow) || || || || a - ++mem || a - ++mem,x || a - ++mem,y || a - ++(mem,x) || a - ++(mem),y || |- | LAX || style="text-align: left;" | &nbsp;load to Acc and X || || || || a=x=mem || || a=x=mem,y || a=x=(mem,x) || a=x=(mem),y || |- | RLA || style="text-align: left;" | &nbsp;mem <- mem <<<, A <- A & mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SAX || style="text-align: left;" | &nbsp;mem = A & X || || || || mem=a&x || || || (mem,x)=a&x || || |- | SLO || style="text-align: left;" | &nbsp;mem <- mem << 1, A <- A | mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SRE || style="text-align: left;" | &nbsp;mem <- mem >> 1, A <- A ^ mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- |} 52dd74de7be8faf10eaf2122ffd1df1a65847777 37 8 2014-12-15T22:08:59Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] {| class="wikitable" style="text-align: center;" ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ADC || style="text-align: left;" | &nbsp;add with carry || || || a+imm || a+mem || a+mem,x || a+mem,y || a+(mem,x) || a+(mem),y || |- | AND || style="text-align: left;" | &nbsp;and (with accumulator) || || || a&imm || a&mem || a&mem,x || a&mem,y || a&(mem,x) || a&(mem),y || |- | ASL || style="text-align: left;" | &nbsp;arithmetic shift left || a<< || || || mem<< || mem,x<< || || || || |- | BCC || style="text-align: left;" | &nbsp;branch on carry clear || colspan="9" | >={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; < goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } < &nbsp;&nbsp;''or''&nbsp;&nbsp; c+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c- |- | BCS || style="text-align: left;" | &nbsp;branch on carry set || colspan="9" | <{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >= &nbsp;&nbsp;''or''&nbsp;&nbsp; c-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c+ |- | BEQ || style="text-align: left;" | &nbsp;branch on equal (zero set) || colspan="9" | { ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; == goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } == |- | BIT || style="text-align: left;" | &nbsp;bit test || || || || a?mem || || || || || |- | BMI || style="text-align: left;" | &nbsp;branch on minus (negative set) || colspan="9" | >=0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <0 |- | BNE || style="text-align: left;" | &nbsp;branch on not equal (zero clear) || colspan="9" | =={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; != goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } != |- | BPL || style="text-align: left;" | &nbsp;branch on plus (negative clear) || colspan="9" | <0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >=0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >=0 |- | BRK || style="text-align: left;" | &nbsp;interrupt || || ''TBD'' || || || || || || || |- | BVC || style="text-align: left;" | &nbsp;branch on overflow clear || colspan="9" | <<={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >>= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >>= &nbsp;&nbsp;''or''&nbsp;&nbsp; o+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o- |- | BVS || style="text-align: left;" | &nbsp;branch on overflow set || colspan="9" | >>={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <<= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <<= &nbsp;&nbsp;''or''&nbsp;&nbsp; o-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o+ |- | CLC || style="text-align: left;" | &nbsp;clear carry || || c- || || || || || || || |- | CLD || style="text-align: left;" | &nbsp;clear decimal || || d- || || || || || || || |- | CLI || style="text-align: left;" | &nbsp;clear interrupt disable || || i- || || || || || || || |- | CLV || style="text-align: left;" | &nbsp;clear overflow || || o- || || || || || || || |- | CMP || style="text-align: left;" | &nbsp;compare (with accumulator) || || || a?imm || a?mem || a?mem,x || a?mem,y || a?(mem,x) || a?(mem),y || |- | CPX || style="text-align: left;" | &nbsp;compare with X || || || x?imm || x?mem || || || || || |- | CPY || style="text-align: left;" | &nbsp;compare with Y || || || y?imm || y?mem || || || || || |- | DEC || style="text-align: left;" | &nbsp;decrement || || || || mem-- || mem,x-- || || || || |- | DEX || style="text-align: left;" | &nbsp;decrement X || || x-- || || || || || || || |- | DEY || style="text-align: left;" | &nbsp;decrement Y || || y-- || || || || || || || |- | EOR || style="text-align: left;" | &nbsp;exclusive or (with accumulator) || || || a^imm || a^mem || a^mem,x || a^mem,y || a^(mem,x) || a^(mem),y || |- | INC || style="text-align: left;" | &nbsp;increment || || || || mem++ || mem,x++ || || || || |- | INX || style="text-align: left;" | &nbsp;increment X || || x++ || || || || || || || |- | INY || style="text-align: left;" | &nbsp;increment Y || || y++ || || || || || || || |- | JMP || style="text-align: left;" | &nbsp;jump || || || || goto mem || || || || || goto (mem) |- | JSR || style="text-align: left;" | &nbsp;jump subroutine || || || || call mem || || || || || |- | LAS || style="text-align: left;" | &nbsp; || || || || || || || || || |- | LDA || style="text-align: left;" | &nbsp;load accumulator || || || a=imm || a=mem || a=mem,x || a=mem,y || a=(mem,x) || a=(mem),y || |- | LDX || style="text-align: left;" | &nbsp;load X || || || x=imm || x=mem || || x=mem,y || || || |- | LDY || style="text-align: left;" | &nbsp;load Y || || || y=imm || y=mem || y=mem,x || || || || |- | LSR || style="text-align: left;" | &nbsp;logical shift right || a>> || || || mem>> || mem,x>> || || || || |- | NOP || style="text-align: left;" | &nbsp;no operation || colspan="9" | * ''(for single NOP)'' &nbsp;&nbsp;''or''&nbsp;&nbsp; *''<number>'' ''(to wait <number> of cycles)'' |- | ORA || style="text-align: left;" | &nbsp;or with accumulator || || || a|imm || a|mem || a|mem,x || a|mem,y || a|(mem,x) || a|(mem),y || |- | PHA || style="text-align: left;" | &nbsp;push accumulator || || a!! || || || || || || || |- | PHP || style="text-align: left;" | &nbsp;push processor status (SR) || || flag!! || || || || || || || |- | PLA || style="text-align: left;" | &nbsp;pull accumulator || || a?? || || || || || || || |- | PLP || style="text-align: left;" | &nbsp;pull processor status (SR) || || flag?? || || || || || || || |- | ROL || style="text-align: left;" | &nbsp;rotate left || a<<< || || || mem<<< || mem,x<<< || || || || |- | ROR || style="text-align: left;" | &nbsp;rotate right || a>>> || || || mem>>> || mem,x>>> || || || || |- | RRA || style="text-align: left;" | &nbsp; || || || || || || || || || |- | RTI || style="text-align: left;" | &nbsp;return from interrupt || || ''TBD'' || || || || || || || |- | RTS || style="text-align: left;" | &nbsp;return from subroutine || || return || || || || || || || |- | SBC || style="text-align: left;" | &nbsp;subtract with carry || || || a-imm || a-mem || a-mem,x || a-mem,y || a-(mem,x) || a-(mem),y || |- | SEC || style="text-align: left;" | &nbsp;set carry || || c+ || || || || || || || |- | SED || style="text-align: left;" | &nbsp;set decimal || || d+ || || || || || || || |- | SEI || style="text-align: left;" | &nbsp;set interrupt disable || || i- || || || || || || || |- | STA || style="text-align: left;" | &nbsp;store accumulator || || || || mem=a || mem,x=a || mem,y=a || (mem,x)=a || (mem),y=a || |- | STX || style="text-align: left;" | &nbsp;store X || || || || mem=x || || || || || |- | STY || style="text-align: left;" | &nbsp;store Y || || || || mem=y || || || || || |- | TAX || style="text-align: left;" | &nbsp;transfer accumulator to X || || x=a || || || || || || || |- | TAY || style="text-align: left;" | &nbsp;transfer accumulator to Y || || y=a || || || || || || || |- | TSX || style="text-align: left;" | &nbsp;transfer stack pointer to X || || x=s || || || || || || || |- | TXA || style="text-align: left;" | &nbsp;transfer X to accumulator || || a=x || || || || || || || |- | TXS || style="text-align: left;" | &nbsp;transfer X to stack pointer || || s=x || || || || || || || |- | TYA || style="text-align: left;" | &nbsp;transfer Y to accumulator || || a=y || || || || || || || |- |} {| class="wikitable" style="text-align: center;" ! colspan="11" | Undocumented 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ANC || style="text-align: left;" | &nbsp;A <- A & imm, C <- bit 7 || || || a&.imm || || || || || || |- | ARR || style="text-align: left;" | &nbsp;A <- (A & imm) ror>>> || || || ''TBD'' || || || || || || |- | ASR || style="text-align: left;" | &nbsp;A <- (A & imm) >> 1 || || || ''TBD'' || || || || || || |- | AXS || style="text-align: left;" | &nbsp;X <- (A & X) - imm &nbsp;&nbsp;(no borrow) || || || x&=a-imm || || || || || || |- | DCP || style="text-align: left;" | &nbsp;decrement mem, then compare Acc to mem || || || || a?--mem || a?--mem,x || a?--mem,y || a?--(mem,x) || a?--(mem),y || |- | ISC || style="text-align: left;" | &nbsp;increment mem, then subtract mem from Acc (with borrow) || || || || a - ++mem || a - ++mem,x || a - ++mem,y || a - ++(mem,x) || a - ++(mem),y || |- | LAX || style="text-align: left;" | &nbsp;load to Acc and X || || || || a=x=mem || || a=x=mem,y || a=x=(mem,x) || a=x=(mem),y || |- | RLA || style="text-align: left;" | &nbsp;mem <- mem <<<, A <- A & mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SAX || style="text-align: left;" | &nbsp;mem = A & X || || || || mem=a&x || || || (mem,x)=a&x || || |- | SLO || style="text-align: left;" | &nbsp;mem <- mem << 1, A <- A | mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SRE || style="text-align: left;" | &nbsp;mem <- mem >> 1, A <- A ^ mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- |} 308a3399825521ff7a5a1d0878811da370f4279d 8 6 2014-12-11T09:24:01Z Krzysiek 1 wikitext text/x-wiki {| class="wikitable" style="text-align: center;" ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ADC || style="text-align: left;" | &nbsp;add with carry || || || a+imm || a+mem || a+mem,x || a+mem,y || a+(mem,x) || a+(mem),y || |- | AND || style="text-align: left;" | &nbsp;and (with accumulator) || || || a&imm || a&mem || a&mem,x || a&mem,y || a&(mem,x) || a&(mem),y || |- | ASL || style="text-align: left;" | &nbsp;arithmetic shift left || a<< || || || mem<< || mem,x<< || || || || |- | BCC || style="text-align: left;" | &nbsp;branch on carry clear || colspan="9" | >={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; < goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } < &nbsp;&nbsp;''or''&nbsp;&nbsp; c+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c- |- | BCS || style="text-align: left;" | &nbsp;branch on carry set || colspan="9" | <{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >= &nbsp;&nbsp;''or''&nbsp;&nbsp; c-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; c+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } c+ |- | BEQ || style="text-align: left;" | &nbsp;branch on equal (zero set) || colspan="9" | { ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; == goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } == |- | BIT || style="text-align: left;" | &nbsp;bit test || || || || a?mem || || || || || |- | BMI || style="text-align: left;" | &nbsp;branch on minus (negative set) || colspan="9" | >=0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <0 |- | BNE || style="text-align: left;" | &nbsp;branch on not equal (zero clear) || colspan="9" | =={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; != goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } != |- | BPL || style="text-align: left;" | &nbsp;branch on plus (negative clear) || colspan="9" | <0{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >=0 goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >=0 |- | BRK || style="text-align: left;" | &nbsp;interrupt || || ''TBD'' || || || || || || || |- | BVC || style="text-align: left;" | &nbsp;branch on overflow clear || colspan="9" | <<={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; >>= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } >>= &nbsp;&nbsp;''or''&nbsp;&nbsp; o+{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o- goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o- |- | BVS || style="text-align: left;" | &nbsp;branch on overflow set || colspan="9" | >>={ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; <<= goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } <<= &nbsp;&nbsp;''or''&nbsp;&nbsp; o-{ ... } &nbsp;&nbsp;''or''&nbsp;&nbsp; o+ goto label &nbsp;&nbsp;''or''&nbsp;&nbsp; { ... } o+ |- | CLC || style="text-align: left;" | &nbsp;clear carry || || c- || || || || || || || |- | CLD || style="text-align: left;" | &nbsp;clear decimal || || d- || || || || || || || |- | CLI || style="text-align: left;" | &nbsp;clear interrupt disable || || i- || || || || || || || |- | CLV || style="text-align: left;" | &nbsp;clear overflow || || o- || || || || || || || |- | CMP || style="text-align: left;" | &nbsp;compare (with accumulator) || || || a?imm || a?mem || a?mem,x || a?mem,y || a?(mem,x) || a?(mem),y || |- | CPX || style="text-align: left;" | &nbsp;compare with X || || || x?imm || x?mem || || || || || |- | CPY || style="text-align: left;" | &nbsp;compare with Y || || || y?imm || y?mem || || || || || |- | DEC || style="text-align: left;" | &nbsp;decrement || || || || mem-- || mem,x-- || || || || |- | DEX || style="text-align: left;" | &nbsp;decrement X || || x-- || || || || || || || |- | DEY || style="text-align: left;" | &nbsp;decrement Y || || y-- || || || || || || || |- | EOR || style="text-align: left;" | &nbsp;exclusive or (with accumulator) || || || a^imm || a^mem || a^mem,x || a^mem,y || a^(mem,x) || a^(mem),y || |- | INC || style="text-align: left;" | &nbsp;increment || || || || mem++ || mem,x++ || || || || |- | INX || style="text-align: left;" | &nbsp;increment X || || x++ || || || || || || || |- | INY || style="text-align: left;" | &nbsp;increment Y || || y++ || || || || || || || |- | JMP || style="text-align: left;" | &nbsp;jump || || || || goto mem || || || || || goto (mem) |- | JSR || style="text-align: left;" | &nbsp;jump subroutine || || || || call mem || || || || || |- | LAS || style="text-align: left;" | &nbsp; || || || || || || || || || |- | LDA || style="text-align: left;" | &nbsp;load accumulator || || || a=imm || a=mem || a=mem,x || a=mem,y || a=(mem,x) || a=(mem),y || |- | LDX || style="text-align: left;" | &nbsp;load X || || || x=imm || x=mem || || x=mem,y || || || |- | LDY || style="text-align: left;" | &nbsp;load Y || || || y=imm || y=mem || y=mem,x || || || || |- | LSR || style="text-align: left;" | &nbsp;logical shift right || a>> || || || mem>> || mem,x>> || || || || |- | NOP || style="text-align: left;" | &nbsp;no operation || colspan="9" | * ''(for single NOP)'' &nbsp;&nbsp;''or''&nbsp;&nbsp; *''<number>'' ''(to wait <number> of cycles)'' |- | ORA || style="text-align: left;" | &nbsp;or with accumulator || || || a|imm || a|mem || a|mem,x || a|mem,y || a|(mem,x) || a|(mem),y || |- | PHA || style="text-align: left;" | &nbsp;push accumulator || || a!! || || || || || || || |- | PHP || style="text-align: left;" | &nbsp;push processor status (SR) || || flag!! || || || || || || || |- | PLA || style="text-align: left;" | &nbsp;pull accumulator || || a?? || || || || || || || |- | PLP || style="text-align: left;" | &nbsp;pull processor status (SR) || || flag?? || || || || || || || |- | ROL || style="text-align: left;" | &nbsp;rotate left || a<<< || || || mem<<< || mem,x<<< || || || || |- | ROR || style="text-align: left;" | &nbsp;rotate right || a>>> || || || mem>>> || mem,x>>> || || || || |- | RRA || style="text-align: left;" | &nbsp; || || || || || || || || || |- | RTI || style="text-align: left;" | &nbsp;return from interrupt || || ''TBD'' || || || || || || || |- | RTS || style="text-align: left;" | &nbsp;return from subroutine || || return || || || || || || || |- | SBC || style="text-align: left;" | &nbsp;subtract with carry || || || a-imm || a-mem || a-mem,x || a-mem,y || a-(mem,x) || a-(mem),y || |- | SEC || style="text-align: left;" | &nbsp;set carry || || c+ || || || || || || || |- | SED || style="text-align: left;" | &nbsp;set decimal || || d+ || || || || || || || |- | SEI || style="text-align: left;" | &nbsp;set interrupt disable || || i- || || || || || || || |- | STA || style="text-align: left;" | &nbsp;store accumulator || || || || mem=a || mem,x=a || mem,y=a || (mem,x)=a || (mem),y=a || |- | STX || style="text-align: left;" | &nbsp;store X || || || || mem=x || || || || || |- | STY || style="text-align: left;" | &nbsp;store Y || || || || mem=y || || || || || |- | TAX || style="text-align: left;" | &nbsp;transfer accumulator to X || || x=a || || || || || || || |- | TAY || style="text-align: left;" | &nbsp;transfer accumulator to Y || || y=a || || || || || || || |- | TSX || style="text-align: left;" | &nbsp;transfer stack pointer to X || || x=s || || || || || || || |- | TXA || style="text-align: left;" | &nbsp;transfer X to accumulator || || a=x || || || || || || || |- | TXS || style="text-align: left;" | &nbsp;transfer X to stack pointer || || s=x || || || || || || || |- | TYA || style="text-align: left;" | &nbsp;transfer Y to accumulator || || a=y || || || || || || || |- |} {| class="wikitable" style="text-align: center;" ! colspan="11" | Undocumented 6502 opcodes |- ! rowspan="2" | Opcode ! rowspan="2" | Description ! colspan="9" | K65 Syntax |- | width="7%" | Acc | width="7%" | Implied | width="7%" | Imm | width="7%" | Mem | width="7%" | Mem,X | width="7%" | Mem,Y | width="7%" | (Mem,X) | width="7%" | (Mem),Y | width="7%" | (Mem) |- | ANC || style="text-align: left;" | &nbsp;A <- A & imm, C <- bit 7 || || || a&.imm || || || || || || |- | ARR || style="text-align: left;" | &nbsp;A <- (A & imm) ror>>> || || || ''TBD'' || || || || || || |- | ASR || style="text-align: left;" | &nbsp;A <- (A & imm) >> 1 || || || ''TBD'' || || || || || || |- | AXS || style="text-align: left;" | &nbsp;X <- (A & X) - imm &nbsp;&nbsp;(no borrow) || || || x&=a-imm || || || || || || |- | DCP || style="text-align: left;" | &nbsp;decrement mem, then compare Acc to mem || || || || a?--mem || a?--mem,x || a?--mem,y || a?--(mem,x) || a?--(mem),y || |- | ISC || style="text-align: left;" | &nbsp;increment mem, then subtract mem from Acc (with borrow) || || || || a - ++mem || a - ++mem,x || a - ++mem,y || a - ++(mem,x) || a - ++(mem),y || |- | LAX || style="text-align: left;" | &nbsp;load to Acc and X || || || || a=x=mem || || a=x=mem,y || a=x=(mem,x) || a=x=(mem),y || |- | RLA || style="text-align: left;" | &nbsp;mem <- mem <<<, A <- A & mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SAX || style="text-align: left;" | &nbsp;mem = A & X || || || || mem=a&x || || || (mem,x)=a&x || || |- | SLO || style="text-align: left;" | &nbsp;mem <- mem << 1, A <- A | mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- | SRE || style="text-align: left;" | &nbsp;mem <- mem >> 1, A <- A ^ mem || || || || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || ''TBD'' || |- |} 7bc0e51b24002340f489b2b875428a23606f63de 6 2014-12-10T22:01:39Z Krzysiek 1 Created page with "{| ! Opcode ! K65 Syntax ! Description |- |ADC |a+# |add with carry |- |AND |a&# |and (with accumulator) |- |ASL |#<< |arithmetic shift left |- BCC .... branch on carry clear..." wikitext text/x-wiki {| ! Opcode ! K65 Syntax ! Description |- |ADC |a+# |add with carry |- |AND |a&# |and (with accumulator) |- |ASL |#<< |arithmetic shift left |- BCC .... branch on carry clear >={...} |- |BCS .... branch on carry set <{...} |- |BEQ .... branch on equal (zero set) =={...} |- |BIT .... bit test a?# |- |BMI .... branch on minus (negative set) <0{...} |- |BNE .... branch on not equal (zero clear) !={...} |- |BPL .... branch on plus (negative clear) >=0{...} |- |BRK .... interrupt brk |- |BVC .... branch on overflow clear >>={...} |- |BVS .... branch on overflow set <<={...} |- |CLC .... clear carry c- |- |CLD .... clear decimal d- |- |CLI .... clear interrupt disable i- |- |CLV .... clear overflow o- CMP .... compare (with accumulator) a?# CPX .... compare with X a?x CPY .... compare with Y a?y DEC .... decrement #-- DEX .... decrement X x-- DEY .... decrement Y y-- EOR .... exclusive or (with accumulator) a^# INC .... increment #++ INX .... increment X x++ INY .... increment Y y++ JMP .... jump goto ## JSR .... jump subroutine goto (##) LDA .... load accumulator a=# LDX .... load X x=# LDY .... load Y y=# LSR .... logical shift right #>> NOP .... no operation nop ORA .... or with accumulator a|# PHA .... push accumulator a! PHP .... push processor status (SR) sr! PLA .... pull accumulator a? PLP .... pull processor status (SR) sr? ROL .... rotate left #<<< ROR .... rotate right #>>> RTI .... return from interrupt rti RTS .... return from subroutine ret rts SBC .... subtract with carry a-# SEC .... set carry c+ SED .... set decimal d+ SEI .... set interrupt disable i- STA .... store accumulator #=a STX .... store X #=x STY .... store Y #=y TAX .... transfer accumulator to X x=a TAY .... transfer accumulator to Y y=a TSX .... transfer stack pointer to X x=s TXA .... transfer X to accumulator a=x TXS .... transfer X to stack pointer s=x TYA .... transfer Y to accumulator a=y |- |Orange |10 |7.00 |- |Bread |4 |3.00 |- |Butter |1 |5.00 |- |Total | |15.00 |} f6c1ad421c246f100f9496382a3ef2ce53f8c77d K65 Known Bugs 0 3 64 63 2014-12-21T02:21:30Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''[[K65]]''' Known Bugs * Accidential bank switching can occur when branch instruction jumps back from last bank to previous bank. Example: branch instruction at $1F0C jumps back to $1EF4 - because branching across page boundary is done in 6502 in two steps (first compute lower address, then higher), CPU does extra memory fetch from $1FF4 (old high address byte, new low address). This can trigger unwanted bank switching. Currently there is no way of detecting this. * Far calls placed in ''inline'' blocks do not work correctly if the inline is used in different bank that it was defined. * Local labels can't be accessed across certain language constructs (like far calls). Local labels before and after such construct appear to be in different local namespaces. * Code parser can hang on unexpected input characters. 459c9b5d3e4279e6ba539bd83c50ca5071421e6f 63 38 2014-12-21T02:21:20Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] '''[[K65]]''' Known Bugs * Accidential bank switching can occur when branch instruction jumps back from last bank to previous bank. Example: branch instruction at $1F0C jumps back to $1EF4 - because branching across page boundary is done in 6502 in two steps (first compute lower address, then higher), CPU does extra memory fetch from $1FF4 (old high address byte, new low address). This can trigger unwanted bank switching. Currently there is no way of detecting this. * Far calls placed in ''inline'' blocks do not work correctly if the inline is used in different bank that it was defined. * Local labels can't be accessed across certain language constructs (like far calls). Local labels before and after such construct appear to be in different local namespaces. * Code parser can hang on unexpected input characters. 3880ef6de5e83dd7c4dfa1ea4637ec90c6006a82 38 9 2014-12-15T22:09:15Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] == K65 Known Bugs == * Accidential bank switching can occur when branch instruction jumps back from last bank to previous bank. Example: branch instruction at $1F0C jumps back to $1EF4 - because branching across page boundary is done in 6502 in two steps (first compute lower address, then higher), CPU does extra memory fetch from $1FF4 (old high address byte, new low address). This can trigger unwanted bank switching. Currently there is no way of detecting this. * Far calls placed in ''inline'' blocks do not work correctly if the inline is used in different bank that it was defined. * Local labels can't be accessed across certain language constructs (like far calls). Local labels before and after such construct appear to be in different local namespaces. * Code parser can hang on unexpected input characters. 042dba1bc84dd640e5d78091c24bada145198217 9 2014-12-11T09:42:50Z Krzysiek 1 Created page with " == K65 Known Bugs == * Accidential bank switching can occur when branch instruction jumps back from last bank to previous bank. Example: branch instruction at $1F0C jumps bac..." wikitext text/x-wiki == K65 Known Bugs == * Accidential bank switching can occur when branch instruction jumps back from last bank to previous bank. Example: branch instruction at $1F0C jumps back to $1EF4 - because branching across page boundary is done in 6502 in two steps (first compute lower address, then higher), CPU does extra memory fetch from $1FF4 (old high address byte, new low address). This can trigger unwanted bank switching. Currently there is no way of detecting this. * Far calls placed in ''inline'' blocks do not work correctly if the inline is used in different bank that it was defined. * Local labels can't be accessed across certain language constructs (like far calls). Local labels before and after such construct appear to be in different local namespaces. * Code parser can hang on unexpected input characters. 90095bd5b066b3ab790b9fcfe064eb6668d81495 K65 Syntax 0 10 83 82 2015-06-15T15:58:18Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variable declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the [[K65 Evaluator|evaluator]]. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } === Compile-time Evaluator === The K65 compiler has embedded evaluator that always executes at compile-time. The evaluator can perform arbitrary math operations which results are inlined in the final code as immediates. The evaluator can also set and use global compiler constants. The evaluator is explained in detail on [[K65 Evaluator]] page. === Code sections === Executable code in K65 compiler is specified in sections. There currently supported types of code sections are: ; main : main function being program entry point main { a=0 // set accumulator to 0 {} always // loop forever } ; func : user defined function, that can be called from the code func inc_x { x++ // increments X register and returns } // RTS is added automatically ; naked : just like ''func'', but no RTS is added automatically at the end naked inc_x_twice { x++ // increments X register goto inc_x // jump to previously defined inc_x (saves stack) } // no RTS here; make sure function never reaches here ; inline : user defined macro that is inlined in the code when used inline inc_y { y++ } Functions and inlines are used simply by specifying their names, which places JSR opcode or inlines the code. Function and inline calls do not pass any parameters. Any potential parameter and return value handling must be handled explicitly by the programmer using either registers, stack or predetermined memory locations. func test { inc_x // this will use JSR instruction to call 'inc_x' defined earlier inc_y // this will inline the 'inc_y' inline - note that it will not add any overhead compared to simple 'y++' } ; Far calls Functions can also be called with ''far'' prefix to mark that the target function is in another bank, than the current one. The bankswitching mechanism used is defined by the linker. Inlines do not use ''far'' prefix, because the code is simply inlined. '''NOTE:''' if ''far'' call is used within inline make sure to use such inline with care - inlining such inline in another bank will copy the inline code directly, which will usually result in improper bankswitching and program crash. func test2_in_different_bank { far inc_x } 6549ea59e1665d95706f60e6356b05d80f36ae82 82 81 2015-06-15T15:57:15Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variable declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the [[K65 Evaluator|evaluator]]. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } === Compile-time Evaluator === The K65 compiler has embedded evaluator that always executes at compile-time. The evaluator can perform arbitrary math operations which results are inlined in the final code as immediates. The evaluator can also set and use global compiler constants. The evaluator is explained in detail on [[K65 Evaluator]] page. === Code sections === Executable code in K65 compiler is specified in sections. There currently supported types of code sections are: ; main : main function being program entry point main { a=0 // set accumulator to 0 {} always // loop forever } ; func : user defined function, that can be called from the code func inc_x { x++ // increments X register and returns } // RTS is added automatically ; naked : just like ''func'', but no RTS is added automatically at the end naked inc_x_twice { x++ // increments X register goto inc_x // jump to previously defined inc_x (saves stack) } // no RTS here; make sure function never reaches here ; inline : user defined macro that is inlined in the code when used inline inc_y { y++ } Functions and inlines are used simply by specifying their names, which places JSR opcode or inlines the code. Function and inline calls do not pass any parameters. Any potential parameter and return value handling must be handled explicitly by the programmer using either registers, stack or predetermined memory locations. func test { inc_x // this will use JSR instruction to call 'inc_x' defined earlier inc_y // this will inline the 'inc_y' inline - note that it will not add any overhead compared to simple 'y++' } ==== Far calls ==== Functions can also be called with ''far'' prefix to mark that the target function is in another bank, than the current one. The bankswitching mechanism used is defined by the linker. Inlines do not use ''far'' prefix, because the code is simply inlined. '''NOTE:''' if ''far'' call is used within inline make sure to use such inline with care - inlining such inline in another bank will copy the inline code directly, which will usually result in improper bankswitching and program crash. func test2_in_different_bank { far inc_x } 2f46cc2a6f4b9b5cf6005b9232309ff8cc6d3a43 81 80 2015-06-15T15:56:28Z Krzysiek 1 /* Code sections */ wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variable declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the [[K65 Evaluator|evaluator]]. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } === Compile-time Evaluator === The K65 compiler has embedded evaluator that always executes at compile-time. The evaluator can perform arbitrary math operations which results are inlined in the final code as immediates. The evaluator can also set and use global compiler constants. The evaluator is explained in detail on [[K65 Evaluator]] page. === Code sections === Executable code in K65 compiler is specified in sections. There currently supported types of code sections are: ; main : main function being program entry point main { a=0 // set accumulator to 0 {} always // loop forever } ; func : user defined function, that can be called from the code func inc_x { x++ // increments X register and returns } // RTS is added automatically ; naked : just like ''func'', but no RTS is added automatically at the end naked inc_x_twice { x++ // increments X register goto inc_x // jump to previously defined inc_x (saves stack) } // no RTS here; make sure function never reaches here ; inline : user defined macro that is inlined in the code when used inline inc_y { y++ } Functions and inlines are used simply by specifying their names, which places JSR opcode or inlines the code. Function and inline calls do not pass any parameters. Any potential parameter and return value handling must be handled explicitly by the programmer using either registers, stack or predetermined memory locations. func test { inc_x // this will use JSR instruction to call 'inc_x' defined earlier inc_y // this will inline the 'inc_y' inline - note that it will not add any overhead compared to simple 'y++' } = Far calls = Functions can also be called with ''far'' prefix to mark that the target function is in another bank, than the current one. The bankswitching mechanism used is defined by the linker. Inlines do not use ''far'' prefix, because the code is simply inlined. '''NOTE:''' if ''far'' call is used within inline make sure to use such inline with care - inlining such inline in another bank will copy the inline code directly, which will usually result in improper bankswitching and program crash. func test2_in_different_bank { far inc_x } 2f9590eb6ab1695ad3bc42615b3b97a2934fc558 80 79 2015-06-15T15:50:17Z Krzysiek 1 /* Code sections */ wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variable declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the [[K65 Evaluator|evaluator]]. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } === Compile-time Evaluator === The K65 compiler has embedded evaluator that always executes at compile-time. The evaluator can perform arbitrary math operations which results are inlined in the final code as immediates. The evaluator can also set and use global compiler constants. The evaluator is explained in detail on [[K65 Evaluator]] page. === Code sections === Executable code in K65 compiler is specified in sections. There currently supported types of code sections are: ; main : main function being program entry point main { a=0 // set accumulator to 0 {} always // loop forever } ; func : user defined function, that can be called from the code func inc_x { x++ // increments X register and returns } // RTS is added automatically ; naked : just like ''func'', but no RTS is added automatically at the end naked inc_x_twice { x++ // increments X register goto inc_x // jump to previously defined inc_x (saves stack) } // no RTS here; make sure function never reaches here ; inline : user defined macro that is inlined in the code when used inline inc_y { y++ } Functions and inlines are used simply by specifying their names, which places JSR opcode or inlines the code. Function and inline calls do not pass any parameters. Any potential parameter and return value handling must be handled explicitly by the programmer using either registers, stack or predetermined memory locations. func test { inc_x // this will use JSR instruction to call 'inc_x' defined earlier inc_y // this will inline the 'inc_y' inline - note that it will not add any overhead compared to simple 'y++' } Functions can also be called with ''far'' prefix to mark that the target function is in another bank, than the current one. The bankswitching mechanism used is defined by the linker. Inlines do not use ''far'' prefix, because the code is simply inlined. '''NOTE:''' if ''far'' call is used within inline make sure to use such inline with care - inlining such inline in another bank will copy the inline code directly, which will usually result in improper bankswitching and program crash. func test2_in_different_bank { far inc_x } 6ca799698998e66cf9d2f098290e30dac3ec1ebe 79 76 2015-06-12T13:10:35Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variable declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the [[K65 Evaluator|evaluator]]. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } === Compile-time Evaluator === The K65 compiler has embedded evaluator that always executes at compile-time. The evaluator can perform arbitrary math operations which results are inlined in the final code as immediates. The evaluator can also set and use global compiler constants. The evaluator is explained in detail on [[K65 Evaluator]] page. === Code sections === Executable code in K65 compiler is specified in sections. There currently supported types of code sections are: ; main : main function being program entry point main { a=0 // set accumulator to 0 {} always // loop forever } ; func : user defined function, that can be called from the code func inc_x { x++ // increments X register and returns } // RTS is added automatically ; inline : user defined macro that is inlined in the code when used inline inc_y { y++ } Functions and inlines are used simply by specifying their names, which places JSR opcode or inlines the code. Function and inline calls do not pass any parameters. Any potential parameter and return value handling must be handled explicitly by the programmer using either registers, stack or predetermined memory locations. func test { inc_x // this will use JSR instruction to call 'inc_x' defined earlier inc_y // this will inline the 'inc_y' inline - note that it will not add any overhead compared to simple 'y++' } Functions can also be called with ''far'' prefix to mark that the target function is in another bank, than the current one. The bankswitching mechanism used is defined by the linker. Inlines do not use ''far'' prefix, because the code is simply inlined. '''NOTE:''' if ''far'' call is used within inline make sure to use such inline with care - inlining such inline in another bank will copy the inline code directly, which will usually result in improper bankswitching and program crash. func test2_in_different_bank { far inc_x } e41d30d030f6e895de3b1d828ce5e9d99da2f809 76 54 2015-06-12T12:36:15Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variable declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the [[K65 Evaluator|evaluator]]. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } === Compile-time Evaluator === The K65 compiler has embedded evaluator that always executes at compile-time. The evaluator can perform arbitrary math operations which results are inlined in the final code as immediates. The evaluator can also set and use global compiler constants. The evaluator is explained in detail on [[K65 Evaluator]] page. c56a88213e27979e3fd4110ebb8502713d89bd89 54 49 2014-12-19T23:07:40Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variable declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the evaluator. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } === Compile-time Evaluator === The K65 compiler has embedded evaluator that always executes at compile-time. The evaluator can perform arbitrary math operations which results are inlined in the final code as immediates. The evaluator can also set and use global compiler constants. The evaluator is explained in detail on [[K65 Evaluator]] page. 619c10c93d0d65aa3bb6a760c649671a220e9d4d 49 46 2014-12-19T22:12:58Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variabl declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the evaluator. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } === Compile-time Evaluator === The K65 compiler has embedded evaluator that always executes at compile-time. The evaluator can perform arbitrary math operations which results are inlined in the final code as immediates. The evaluator can also set and use global compiler constants. The evaluator is explained in detail on [[K65 Evaluator]] page. 88509a15cd6c33d0abbe27b60d8256fc7ff4bb33 46 39 2014-12-15T22:17:16Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variabl declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the evaluator. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } === Compile-time Evaluator === The K65 compiler has embedded evaluator that always executes at compile-time. The evaluator can perform arbitrary math operations which results are inlined in the final code as immediates. The evaluator can also set and use global compiler constants. c2162fb018fe21eff2d7b475f12602bd6282334f 39 24 2014-12-15T22:09:24Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variabl declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the evaluator. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } 2b1d863fb5129768e8d67a0620f692225dd7267c 24 23 2014-12-11T11:04:58Z Krzysiek 1 wikitext text/x-wiki ''This page is still under construction - much of the infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variabl declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the evaluator. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } e737dfb2204b72bd76a7a0939b16d96fac679d6f 23 22 2014-12-11T11:04:45Z Krzysiek 1 wikitext text/x-wiki ''This page is still under construction - much ofthe infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variabl declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the evaluator. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } 2cad4f3002a86c44f7f30550c49948cd55af6dce 22 20 2014-12-11T11:04:28Z Krzysiek 1 wikitext text/x-wiki ''This page is still under construction - much ofthe infrmation is still to be filled'' === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variabl declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the evaluator. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } d126eec814d9e60c9e2409e27db41edfaca57f7f 20 2014-12-11T11:03:21Z Krzysiek 1 Created page with "=== Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to c..." wikitext text/x-wiki === Comments === K65 uses C-like comments. // this is a line comment /* this is a block comment */ === Variable declaration === Variables in K65 are names given to chosen memory addresses. Examples of variabl declaration: var foo=0x80 // declares 'foo' at address 0x80 var foo2 // declares 'foo2' at address 0x81 (next after previous var) var foo3, foo4 // multiple declarations per line allowed var bar[10], bar2[10] // [] specifies variable size in bytes (address increment for next var) var bar3 ? // adding '?' at the end of var declaration makes compiler print var addresses === Constant declaration === The best way of defining constants is using the evaluator. Constants defined this way can be changed at any moment during compilation. Constants can be any value of floating point type. When used within 6502 instruction, they are converted to single byte by rounding to nearest integer and AND'ing with 0xFF (this way negative values are represented in U2 form). Examples: [ // square brace starts evaluator expression MY_CONSTANT = 5, // define constants SOME_NUMBER = 0x13 ] // end of evaluator expression === Bank selection === While default bank can be chosen in file list for each file, a file can span across multiple banks. Active bank can be changed at any point in the file. Example: bank my_bank // from now on all code and data will go to 'my_bank' === Data block definition === Data blocks are defined using ''data'' keyword. Defining data block at the same time defines a label to its first element, so the block is accessibl using simple indexing (like ''MyData,x''). Datablocks can have optional alignment or no-page-crossing restrictions enabled. Examples: data MyData { align 16 // align to 16 byte boundary 1 2 3 4 5 6 7 8 // data bytes folow } data MyData2 { align 256 + 8 // align to 8 bytes after page boundary (lower address byte will be 0x08) 1 2 3 4 5 6 7 8 // data bytes folow } data MyData3 { nocross // the data will fit completely inside single page, but can be at any offset within it 1 2 3 4 5 6 7 8 // data bytes folow } 5dddd01752ffe06ad81a00745b52acce382b2f8f K65 To Do 0 20 87 73 2016-07-12T07:09:48Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] Here is my current list of things still to be done in '''[[K65]]''' compiler. * Simple: ** signal errors on undefined character in string ** #if's within data ** #if's within code ** support for binary numbers ** report error when section names are reused (e.g. in "inline" section) ** correct support of <flag>+? and <flag>-? branch operators ** >={...}>= loops and similar ** support for negative eval results ** extend binary operations in eval ** change ^ operator to bitwise xor in eval ** 256-byte data section should work with <code>nocross</code> ** add fixed address option for sections ** add option to place sections in multiple banks ** fix lexer hanging on invalid input * Medium: ** support for custom palettes ** mark section as referenced if ANY of its labels are referenced ** array support ** option to force full addressing with zeropage addresses ** include raw binary data from file ** extend computation on labels (compute "Label1 - Label2 + Offset" ) ** switch to external image loader library (OpenIL?) * Hard/large: ** macros ** pure assembly sections ** alternate bankswitching schemes ** alternate platforms ** per-instruction bank bits ** linker refactoring ** generalized linker ** bank blocks jumping ** bank checking when getting addresses ** option to override ORG and RORG execution address ** "lazy" code sections ** target files and names (.bin/.lst/.sym) in config file ** make LST files compatible with DASM/Stella ** language reference document f78ba7e3dd016e9b991b7b30adbb6baae4ea7189 73 2014-12-28T23:28:36Z Krzysiek 1 Created page with "[[Category:K65]] Here is my current list of things still to be done in '''[[K65]]''' compiler. * Simple: ** signal errors on undefined character in string ** #if's within dat..." wikitext text/x-wiki [[Category:K65]] Here is my current list of things still to be done in '''[[K65]]''' compiler. * Simple: ** signal errors on undefined character in string ** #if's within data ** #if's within code ** support for binary numbers ** report error when section names are reused (e.g. in "inline" section) ** correct support of <flag>+? and <flag>-? branch operators ** >={...}>= loops and similar ** support for negative eval results ** extend binary operations in eval ** change ^ operator to bitwise xor in eval ** 256-byte data section should work with <code>nocross</code> ** add fixed address option for sections ** add option to place sections in multiple banks * Medium: ** support for custom palettes ** mark section as referenced if ANY of its labels are referenced ** array support ** option to force full addressing with zeropage addresses ** include raw binary data from file ** extend computation on labels (compute "Label1 - Label2 + Offset" ) ** switch to external image loader library (OpenIL?) * Hard/large: ** macros ** pure assembly sections ** alternate bankswitching schemes ** alternate platforms ** per-instruction bank bits ** linker refactoring ** generalized linker ** bank blocks jumping ** bank checking when getting addresses ** option to override ORG and RORG execution address ** "lazy" code sections ** target files and names (.bin/.lst/.sym) in config file ** make LST files compatible with DASM/Stella ** language reference document 7ecf8b83d2265552a26ca8214673b44de4208e12 K65 Tutorial 1 0 11 68 40 2014-12-21T12:31:36Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] This is Tutorial 1 for '''[[K65]]''' compiler. Note that this tutorial uses [[Alternate VCS definitions]] file. <source lang="c"> /* * Tutorial 01 - simple raster bar animation * * */ var anim = 0x80; // RAM address alias // entry point block is declared with "main" main { init // function/inline call (defined in _defs.k65) { sync1 // enter overscan (yes, we start here from end of display) // some free time here sync2 // trigger VSYNC // more free time here sync3 // display field start x=224 // that's LDX y=anim // and that's LDY { wsync // inline again, this time wait for horizontal blank cbg=y // STY y++ // INY x-- // DEX }!= // repeat (jump) if not zero/not equal (flag Z=0) cbg=a=0 // "p=q=r" is a shortcut for "q=r p=q" for any p/q/r anim++ // INC } always // loop forever (jump) } </source> 08fdcf540c7ea7d7328a7978375f2b24659cf6f7 40 26 2014-12-15T22:09:43Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] <source lang="c"> /* * Tutorial 01 - simple raster bar animation * * */ var anim = 0x80; // RAM address alias // entry point block is declared with "main" main { init // function/inline call (defined in _defs.k65) { sync1 // enter overscan (yes, we start here from end of display) // some free time here sync2 // trigger VSYNC // more free time here sync3 // display field start x=224 // that's LDX y=anim // and that's LDY { wsync // inline again, this time wait for horizontal blank cbg=y // STY y++ // INY x-- // DEX }!= // repeat (jump) if not zero/not equal (flag Z=0) cbg=a=0 // "p=q=r" is a shortcut for "q=r p=q" for any p/q/r anim++ // INC } always // loop forever (jump) } </source> 772b79b65905e00421253cda59a0d54de8955efb 26 25 2014-12-11T11:57:48Z Krzysiek 1 wikitext text/x-wiki <source lang="c"> /* * Tutorial 01 - simple raster bar animation * * */ var anim = 0x80; // RAM address alias // entry point block is declared with "main" main { init // function/inline call (defined in _defs.k65) { sync1 // enter overscan (yes, we start here from end of display) // some free time here sync2 // trigger VSYNC // more free time here sync3 // display field start x=224 // that's LDX y=anim // and that's LDY { wsync // inline again, this time wait for horizontal blank cbg=y // STY y++ // INY x-- // DEX }!= // repeat (jump) if not zero/not equal (flag Z=0) cbg=a=0 // "p=q=r" is a shortcut for "q=r p=q" for any p/q/r anim++ // INC } always // loop forever (jump) } </source> a8dc611005e2f49529d561f5b94142ae200fdbff 25 2014-12-11T11:56:11Z Krzysiek 1 Created page with "<source lang="c" tabwidth="0" style="tab-size: 4;"> /* * Tutorial 01 - simple raster bar animation * * */ var anim = 0x80; // RAM address alias // entry point block is dec..." wikitext text/x-wiki <source lang="c" tabwidth="0" style="tab-size: 4;"> /* * Tutorial 01 - simple raster bar animation * * */ var anim = 0x80; // RAM address alias // entry point block is declared with "main" main { init // function/inline call (defined in _defs.k65) { sync1 // enter overscan (yes, we start here from end of display) // some free time here sync2 // trigger VSYNC // more free time here sync3 // display field start x=224 // that's LDX y=anim // and that's LDY { wsync // inline again, this time wait for horizontal blank cbg=y // STY y++ // INY x-- // DEX }!= // repeat (jump) if not zero/not equal (flag Z=0) cbg=a=0 // "p=q=r" is a shortcut for "q=r p=q" for any p/q/r anim++ // INC } always // loop forever (jump) } </source> 50de3ba5c983d05cec8c68955368a2617ae0f669 K65 Tutorial 2 0 13 69 41 2014-12-21T12:32:28Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] This is Tutorial 2 for '''[[K65]]''' compiler. Note that this tutorial uses [[Alternate VCS definitions]] file. <source lang="c"> /* * Tutorial 02 - using data * * */ // RAM variables var anim = 0x80; var tmp = 0x81; // "data" - declare byte data block data raster_data { 0 0xD0 0xD2 0xD4 0xD6 0xD8 0xDA 0xDC 0xDE 0xDC 0xDA 0xD8 0xD6 0xD4 0xD2 0xD0 } data sine_table { align 256 // this guarantees block starts on address divisible by 256 // this generates precomputed sine table from the formula for x=0..255 eval [ (sin(x/128*pi*2)*.499+.499)*178+1 ] } // "inline" - this code is inlined when it's called inline raster_bar { x=15 { wsync a=raster_data,x cbg=a x-- }!= cbg=a=0 } // entry point block is declared with "main" main { init { sync1 sync2 sync3 // draw top bar raster_bar // tmp - count total empty lines tmp=a=180 // read sine table and wait as much scanlines x=anim y=sine_table,x { wsync tmp-- y-- }!= // draw animated bar raster_bar // wait remaining lines { wsync tmp-- }!= // draw bottom bar raster_bar anim++ } always // loop forever } </source> 82dad1e45c2dfb753411862cac4be301b206b43d 41 28 2014-12-15T22:09:48Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] <source lang="c"> /* * Tutorial 02 - using data * * */ // RAM variables var anim = 0x80; var tmp = 0x81; // "data" - declare byte data block data raster_data { 0 0xD0 0xD2 0xD4 0xD6 0xD8 0xDA 0xDC 0xDE 0xDC 0xDA 0xD8 0xD6 0xD4 0xD2 0xD0 } data sine_table { align 256 // this guarantees block starts on address divisible by 256 // this generates precomputed sine table from the formula for x=0..255 eval [ (sin(x/128*pi*2)*.499+.499)*178+1 ] } // "inline" - this code is inlined when it's called inline raster_bar { x=15 { wsync a=raster_data,x cbg=a x-- }!= cbg=a=0 } // entry point block is declared with "main" main { init { sync1 sync2 sync3 // draw top bar raster_bar // tmp - count total empty lines tmp=a=180 // read sine table and wait as much scanlines x=anim y=sine_table,x { wsync tmp-- y-- }!= // draw animated bar raster_bar // wait remaining lines { wsync tmp-- }!= // draw bottom bar raster_bar anim++ } always // loop forever } </source> 0e488c8be17cf72f6310b98eccc326f548d6840e 28 2014-12-11T12:00:52Z Krzysiek 1 Created page with "<source lang="c"> /* * Tutorial 02 - using data * * */ // RAM variables var anim = 0x80; var tmp = 0x81; // "data" - declare byte data block data raster_data { 0 0xD0 0x..." wikitext text/x-wiki <source lang="c"> /* * Tutorial 02 - using data * * */ // RAM variables var anim = 0x80; var tmp = 0x81; // "data" - declare byte data block data raster_data { 0 0xD0 0xD2 0xD4 0xD6 0xD8 0xDA 0xDC 0xDE 0xDC 0xDA 0xD8 0xD6 0xD4 0xD2 0xD0 } data sine_table { align 256 // this guarantees block starts on address divisible by 256 // this generates precomputed sine table from the formula for x=0..255 eval [ (sin(x/128*pi*2)*.499+.499)*178+1 ] } // "inline" - this code is inlined when it's called inline raster_bar { x=15 { wsync a=raster_data,x cbg=a x-- }!= cbg=a=0 } // entry point block is declared with "main" main { init { sync1 sync2 sync3 // draw top bar raster_bar // tmp - count total empty lines tmp=a=180 // read sine table and wait as much scanlines x=anim y=sine_table,x { wsync tmp-- y-- }!= // draw animated bar raster_bar // wait remaining lines { wsync tmp-- }!= // draw bottom bar raster_bar anim++ } always // loop forever } </source> dfc8b6ce515574864cb6d89f688a6342b5242d93 K65 Tutorial 3 0 14 70 56 2014-12-21T12:32:41Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] This is Tutorial 3 for '''[[K65]]''' compiler. Note that this tutorial uses [[Alternate VCS definitions]] file. <source lang="c"> /* * Tutorial 03 - data... continued * * */ // RAM variables var anim=0x80, cntX, cntY; // you can declare consecutive variables in single statement data sprite { align 256 // image <file> <x0> <y0> <byte> <repeat> - gather bits from image // <file> - file name without ".bmp" extension // <x0> <y0> - first pixel to scan // <byte> - scanning mode for each single byte starting with MSB (count+direction) // <repeat> - scanning mode for consecutive bytes (count+direction) image sprites 0 0 8> 16v // start at pixel (0,0), each byte is 8 bits to the right, repeat 16 times going up image sprites 10 0 8> 16v // do the same from (10,0) image sprites 20 0 8> 16v // and again starting at (20,0) } data SineX { align 256 0 for x=0..213 eval [ (sin(x/212*pi*2)*.499+.499)*130 ] } data SineY { align 256 0 for x=0..255 eval [ (sin(x/256*pi*2)*.499+.499)*180+1 ] } // entry point block is declared with "main" main { init cntX=a=1 { sync1 sync2 sync3 // compute sprite frame and data start a=anim a<< a&0x30 // LDA+ASL+AND - you can write everything in single line, too a?0x30 // CMP =={ a=0x10 } // if zero/equal (uses BNE) y=a // position sprite in X axis x=cntX a=SineX,x nocross { // make sure following code doesn't cross page boundary wsync { a-15 }>=0 a<< a<< a<< a<< a^0x70 hp0=a *5 rp0=a // sprite position trick } wsync hmove=a // ...and in Y axis x=cntY a=SineY,x x=a { wsync x-- }!= // one-liners rulez ;) // draw sprite x=16 cp0=a=0x0F ns0=a=5 // double size { wsync gp0=a=sprite,y wsync y++ x-- }!= wsync gp0=a=0 // animate anim++ cntX-- =={ cntX=a=213 } cntY-- } always // loop forever } </source> 1acd1697413b6e94fc92699c25a369e47213e1f4 56 42 2014-12-21T01:09:38Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] <source lang="c"> /* * Tutorial 03 - data... continued * * */ // RAM variables var anim=0x80, cntX, cntY; // you can declare consecutive variables in single statement data sprite { align 256 // image <file> <x0> <y0> <byte> <repeat> - gather bits from image // <file> - file name without ".bmp" extension // <x0> <y0> - first pixel to scan // <byte> - scanning mode for each single byte starting with MSB (count+direction) // <repeat> - scanning mode for consecutive bytes (count+direction) image sprites 0 0 8> 16v // start at pixel (0,0), each byte is 8 bits to the right, repeat 16 times going up image sprites 10 0 8> 16v // do the same from (10,0) image sprites 20 0 8> 16v // and again starting at (20,0) } data SineX { align 256 0 for x=0..213 eval [ (sin(x/212*pi*2)*.499+.499)*130 ] } data SineY { align 256 0 for x=0..255 eval [ (sin(x/256*pi*2)*.499+.499)*180+1 ] } // entry point block is declared with "main" main { init cntX=a=1 { sync1 sync2 sync3 // compute sprite frame and data start a=anim a<< a&0x30 // LDA+ASL+AND - you can write everything in single line, too a?0x30 // CMP =={ a=0x10 } // if zero/equal (uses BNE) y=a // position sprite in X axis x=cntX a=SineX,x nocross { // make sure following code doesn't cross page boundary wsync { a-15 }>=0 a<< a<< a<< a<< a^0x70 hp0=a *5 rp0=a // sprite position trick } wsync hmove=a // ...and in Y axis x=cntY a=SineY,x x=a { wsync x-- }!= // one-liners rulez ;) // draw sprite x=16 cp0=a=0x0F ns0=a=5 // double size { wsync gp0=a=sprite,y wsync y++ x-- }!= wsync gp0=a=0 // animate anim++ cntX-- =={ cntX=a=213 } cntY-- } always // loop forever } </source> f2cafa002ff064f0382cce7d2e4b12d62d181d91 42 29 2014-12-15T22:09:55Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] <source lang="c"> /* * Tutorial 03 - data... continued * * */ // RAM variables var anim=0x80, cntX, cntY; // you can declare consecutive variables in single statement data sprite { align 256 // image <file> <x0> <y0> <byte> <repeat> - gather bits from image // <file> - file name without ".bmp" extension // <x0> <y0> - first pixel to scan // <byte> - scanning mode for each single byte starting with MSB (count+direction) // <repeat> - scanning mode for consecutive bytes (count+direction) image sprites 0 0 8> 16v // start at pixel (0,0), each byte is 8 bits to the right, repeat 16 times going up image sprites 10 0 8> 16v // do the same from (10,0) image sprites 20 0 8> 16v // and again starting at (20,0) } data SineX { align 256 0 for x=0..213 eval "(sin(x/212*pi*2)*.499+.499)*130" } data SineY { align 256 0 for x=0..255 eval "(sin(x/256*pi*2)*.499+.499)*180+1" } // entry point block is declared with "main" main { init cntX=a=1 { sync1 sync2 sync3 // compute sprite frame and data start a=anim a<< a&0x30 // LDA+ASL+AND - you can write everything in single line, too a?0x30 // CMP =={ a=0x10 } // if zero/equal (uses BNE) y=a // position sprite in X axis x=cntX a=SineX,x nocross { // make sure following code doesn't cross page boundary wsync { a-15 }>=0 a<< a<< a<< a<< a^0x70 hp0=a *5 rp0=a // sprite position trick } wsync hmove=a // ...and in Y axis x=cntY a=SineY,x x=a { wsync x-- }!= // one-liners rulez ;) // draw sprite x=16 cp0=a=0x0F ns0=a=5 // double size { wsync gp0=a=sprite,y wsync y++ x-- }!= wsync gp0=a=0 // animate anim++ cntX-- =={ cntX=a=213 } cntY-- } always // loop forever } </source> 1394a6ba6c8946809f3421a385594433401bcf41 29 2014-12-11T12:01:24Z Krzysiek 1 Created page with "<source lang="c"> /* * Tutorial 03 - data... continued * * */ // RAM variables var anim=0x80, cntX, cntY; // you can declare consecutive variables in single statement data..." wikitext text/x-wiki <source lang="c"> /* * Tutorial 03 - data... continued * * */ // RAM variables var anim=0x80, cntX, cntY; // you can declare consecutive variables in single statement data sprite { align 256 // image <file> <x0> <y0> <byte> <repeat> - gather bits from image // <file> - file name without ".bmp" extension // <x0> <y0> - first pixel to scan // <byte> - scanning mode for each single byte starting with MSB (count+direction) // <repeat> - scanning mode for consecutive bytes (count+direction) image sprites 0 0 8> 16v // start at pixel (0,0), each byte is 8 bits to the right, repeat 16 times going up image sprites 10 0 8> 16v // do the same from (10,0) image sprites 20 0 8> 16v // and again starting at (20,0) } data SineX { align 256 0 for x=0..213 eval "(sin(x/212*pi*2)*.499+.499)*130" } data SineY { align 256 0 for x=0..255 eval "(sin(x/256*pi*2)*.499+.499)*180+1" } // entry point block is declared with "main" main { init cntX=a=1 { sync1 sync2 sync3 // compute sprite frame and data start a=anim a<< a&0x30 // LDA+ASL+AND - you can write everything in single line, too a?0x30 // CMP =={ a=0x10 } // if zero/equal (uses BNE) y=a // position sprite in X axis x=cntX a=SineX,x nocross { // make sure following code doesn't cross page boundary wsync { a-15 }>=0 a<< a<< a<< a<< a^0x70 hp0=a *5 rp0=a // sprite position trick } wsync hmove=a // ...and in Y axis x=cntY a=SineY,x x=a { wsync x-- }!= // one-liners rulez ;) // draw sprite x=16 cp0=a=0x0F ns0=a=5 // double size { wsync gp0=a=sprite,y wsync y++ x-- }!= wsync gp0=a=0 // animate anim++ cntX-- =={ cntX=a=213 } cntY-- } always // loop forever } </source> ec9df9320ac3557df73ef8e06095c6ad7fc0d717 K65 Tutorials 0 12 62 43 2014-12-21T02:20:57Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] List of available '''[[K65]]''' tutorials: * [[K65 Tutorial 1]] - Simple raster bar animation * [[K65 Tutorial 2]] - Using data * [[K65 Tutorial 3]] - Data... continued (embedding images) 600d5d7ebfe78046de14c93d6bf8aa276d48ea65 43 27 2014-12-15T22:10:11Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] List of available K65 tutorials: * [[K65 Tutorial 1]] - Simple raster bar animation * [[K65 Tutorial 2]] - Using data * [[K65 Tutorial 3]] - Data... continued (embedding images) 0bfac6bb8094ec4714d05c6334a7b2b327c4a7b6 27 2014-12-11T12:00:03Z Krzysiek 1 Created page with "List of available K65 tutorials: * [[K65 Tutorial 1]] - Simple raster bar animation * [[K65 Tutorial 2]] - Using data * [[K65 Tutorial 3]] - Data... continued (embedding images)" wikitext text/x-wiki List of available K65 tutorials: * [[K65 Tutorial 1]] - Simple raster bar animation * [[K65 Tutorial 2]] - Using data * [[K65 Tutorial 3]] - Data... continued (embedding images) 09cefb1dcd96bcf0e682bff1003d76d3f28fac09 Main Page 0 1 92 32 2020-06-16T20:32:28Z Krzysiek 1 wikitext text/x-wiki This Wiki contains some documentation for following projects: * [[K65]] - Custom lanuage compiler for 6502 family CPUs * [[dreadtool]] - Asset conversion pipeline for Dread (Amiga FPS game) 036b6503694d61950983cab584ddff5297a20dc3 32 16 2014-12-11T12:03:05Z Krzysiek 1 wikitext text/x-wiki This Wiki contains some documentation for following projects: * [[K65]] - Custom lanuage compiler for 6502 family CPUs 25930120a7ccb39e7bab98724c10a3cedea82606 16 15 2014-12-11T10:01:18Z Krzysiek 1 wikitext text/x-wiki This Wiki contains some documentation for following projects: * [[K65]] 970e58150e7210ae714f87247df7519acbc83866 15 7 2014-12-11T09:54:20Z Krzysiek 1 wikitext text/x-wiki This Wiki contains some documentation for fllowing projects: * [[K65]] 60ea0b33635d8d2e50d3809f302b0a31d3f9a8ed 7 5 2014-12-11T07:09:23Z Krzysiek 1 Reverted edits by [[Special:Contributions/Pj|Pj]] ([[User talk:Pj|talk]]) to last revision by [[User:Krzysiek|Krzysiek]] wikitext text/x-wiki <strong>MediaWiki has been successfully installed.</strong> Consult the [//meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software. == Getting started == * [//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Configuration settings list] * [//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ MediaWiki FAQ] * [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list] * [//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Localise MediaWiki for your language] 8e0aa2f2a7829587801db67d0424d9b447e09867 5 4 2014-12-10T21:58:45Z wikitext 4 2 2014-12-10T21:26:43Z wikitext 2 1 2014-12-10T21:22:10Z wikitext 1 2014-12-10T21:09:34Z MediaWiki default 0 wikitext text/x-wiki <strong>MediaWiki has been successfully installed.</strong> Consult the [//meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software. == Getting started == * [//www.mediawiki.org/wiki/Special:MyLanguage/Manual:Configuration_settings Configuration settings list] * [//www.mediawiki.org/wiki/Special:MyLanguage/Manual:FAQ MediaWiki FAQ] * [https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce MediaWiki release mailing list] * [//www.mediawiki.org/wiki/Special:MyLanguage/Localisation#Translation_resources Localise MediaWiki for your language] 8e0aa2f2a7829587801db67d0424d9b447e09867 Project.cfg 0 24 114 2020-09-30T19:17:42Z Krzysiek 1 Created page with "[[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File structure == The ''project.cfg'' is the main configu..." wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == File structure == The ''project.cfg'' is the main configuration file containing options for the tool. These options can be overridden in ''user.cfg'' file - any options specified there will get priority. The expected usage here is that the ''project.cfg'' will contain all required base settings, while ''user.cfg'' will list only temporary user modifications. The ''user.cfg'' file should be ignored by the source versioning system used. == Example file == The file is a simple text file, which structure and format should clearly be understood below. # This is a comment script-file-0: "dread/code/_defs.code"; script-file-1: "dread/code/weapons.code"; script-file-2: "dread/code/pickups.code"; script-file-3: "dread/code/mon_SPOS.code"; script-file-4: "dread/code/mon_CPOS.code"; script-file-5: "dread/code/mon_HEAD.code"; script-compiled-inline-export: "export/scripts.i"; # This is another comment map-wad: "dread/maps/DemoMap01.wad"; assets-definition: "dread/assets.txt"; export-inline-file-target: "export/frame.inc"; export-inline-file-test: "export/frame.inc"; export-texture-atlas-preview: "export/tex.png"; == Configuration variables == === assets-definition === Relative path to the [[Assets.txt]] file. assets-definition: "dread/assets.txt"; === map-wad === Relative path to the WAD file containing map to be converted. map-wad: "dread/maps/DemoMap01.wad"; === script-file-# === List of script files to be compiled for the game. ''#'' is a number of the file starting from ''0''. script-file-0: "dread/code/_defs.code"; script-file-1: "dread/code/weapons.code"; script-file-2: "dread/code/pickups.code"; script-file-3: "dread/code/mon_SPOS.code"; script-file-4: "dread/code/mon_CPOS.code"; script-file-5: "dread/code/mon_HEAD.code"; 15ddbcf0e868196548296befe37841b289dc5bf2 Projects using K65 0 9 85 66 2015-10-15T10:49:26Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] Projects using '''[[K65]]''' compiler: * [https://www.pouet.net/prod.php?which=62139 Ataventure by DMA] * [https://www.pouet.net/prod.php?which=62944 TIM1T by Cluster & DMA] (K65 used only for audio) * [https://www.pouet.net/prod.php?which=64492 Ascend by Cluster & DMA] * [http://www.pouet.net/prod.php?which=65838 Derivative 2600 by Cluster & DMA] 70aeaf73aa5a0a282ca7be3f61be3f666e6d23fd 66 65 2014-12-21T02:22:47Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] Projects using '''[[K65]]''' compiler: * [https://www.pouet.net/prod.php?which=62139 Ataventure by DMA] * [https://www.pouet.net/prod.php?which=62944 TIM1T by Cluster & DMA] (K65 used only for audio) * [https://www.pouet.net/prod.php?which=64492 Ascend by Cluster & DMA] 4d012259a997194a0fc367bda2c50b8156790282 65 44 2014-12-21T02:21:46Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] Projects using '''[[K65]]''' compiler: * [https://www.pouet.net/prod.php?which=62139 Ataventure by DMA] * [https://www.pouet.net/prod.php?which=64492 Ascend by Cluster & DMA] 3a80c4b6f11ed9a2fbbd32a8e6b46ac00f687ef7 44 18 2014-12-15T22:10:20Z Krzysiek 1 wikitext text/x-wiki [[Category:K65]] Projects using [[K65]] compiler: * [https://www.pouet.net/prod.php?which=62139 Ataventure by DMA] * [https://www.pouet.net/prod.php?which=64492 Ascend by Cluster & DMA] 664e01fd1eaa79b294cc2602518f622aa46478f8 18 2014-12-11T10:09:09Z Krzysiek 1 Created page with "Projects using [[K65]] compiler: * [https://www.pouet.net/prod.php?which=62139 Ataventure by DMA] * [https://www.pouet.net/prod.php?which=64492 Ascend by Cluster & DMA]" wikitext text/x-wiki Projects using [[K65]] compiler: * [https://www.pouet.net/prod.php?which=62139 Ataventure by DMA] * [https://www.pouet.net/prod.php?which=64492 Ascend by Cluster & DMA] ddd978b868e00ff70b0f67aa608273dbd141a7a6 SDK setup 0 25 137 135 2021-09-07T19:24:40Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' = Setting up the DreadTool = In order to get up to speed with mapmaking and asset creation for Dread, carry out the following steps. == Download the SDK == Download the Dread Mapmaking SDK from the link: * ''[link to be posted later]'' Extract all files from the ZIP to a directory of your choice. == Install Doom Builder 2 == Download and install Doom Builder 2. At the time of writing, its download page is: * [http://www.doombuilder.com/index.php?p=downloads Doom Builder 2 download] Please install it according to its installation instructions. == Install custom game definition for Doom Builder 2 == Find a ''Configurations'' directory in the Dread Mapmaking SDK and merge it with ''Configurations'' directory of Doom Builder 2 software. The ''KK_Dread.cfg'' file should reside next to the ''Doom.cfg'', ''Doom2.cfg'' and other game configurations. The ''Includes'' subdirectory should also be merged with Doom Builder 2 ''Includes'' subdirectory in the process. When all is set, Doom Builder 2 should show the Dread game configuration in the dialog after picking ''New Map'' option. [[File:DB2_Dread_game_config_box.png]] All should be set now. Please continue to [[Creating new map]] to test your setup. 33ffc14c8d7131f26cfd1920d9525722cbf70a78 135 133 2021-09-06T21:44:52Z Krzysiek 1 wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' = Setting up the DreadTool = In order to get up to speed with mapmaking and asset creation for Dread, carry out the following steps. == Download the SDK == Download the Dread Mapmaking SDK from the link: * ''[link to be posted later]'' Extract all files from the ZIP to a directory of your choice. == Install Doom Builder 2 == Download and install Doom Builder 2. At the time of writing, its download page is: * [http://www.doombuilder.com/index.php?p=downloads Doom Builder 2 download] Please install it according to its installation instructions. == Install custom game definition for Doom Builder 2 == Find a ''Configurations'' directory in the Dread Mapmaking SDK and merge it with ''Configurations'' directory of Doom Builder 2 software. The ''KK_Dread.cfg'' file should reside next to the ''Doom.cfg'', ''Doom2.cfg'' and other game configurations. The ''Includes'' subdirectory should also be merged with Doom Builder 2 ''Includes'' subdirectory in the process. When all is set, Doom Builder 2 should show the Dread game configuration in the dialog after picking ''New Map'' option. [[File:DB2_Dread_game_config_box.png]] == Run Doom Builder 2 and create new map == == Run DreadTool == edb48dd60b6935e80d14a65f2766059f145d3566 133 2021-09-06T21:20:44Z Krzysiek 1 Created page with "[[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == Setting up the DreadTool == In order to get up to speed w..." wikitext text/x-wiki [[Category:dreadtool]] ''This page is still under construction - much of the information is still to be filled'' == Setting up the DreadTool == In order to get up to speed with mapmaking and asset creation for Dread, carry out the following steps. === Download the SDK === Download the Dread Mapmaking SDK from the link: * ''[link to be posted later]'' Extract all files from the ZIP to a directory of your choice. === Install Doom Builder 2 === Download and install Doom Builder 2. At the time of writing, its download page is: * [http://www.doombuilder.com/index.php?p=downloads Doom Builder 2 download] Please install it according to its installation instructions. === Install custom game definition for Doom Builder 2 === Find a ''Configurations'' directory in the Dread Mapmaking SDK and merge it with ''Configurations'' directory of Doom Builder 2 software. The ''KK_Dread.cfg'' file should reside next to the ''Doom.cfg'', ''Doom2.cfg'' and other game configurations. The ''Includes'' subdirectory should also be merged with Doom Builder 2 ''Includes'' subdirectory in the process. When all is set, Doom Builder 2 should [[File:DB2_Dread_game_config_box.png]] === Create PK3 resource database === === Run Doom Builder 2 === === Run DreadTool === 839120a109fe1f16da611279ff6c59b9db2cfca6 Widget:YouTube 0 8 17 2014-12-11T10:03:54Z Krzysiek 1 Created page with "<noinclude> This widget allows you to add a [https://developers.google.com/youtube/player_parameters YouTube video player] to your wiki page. == Using this widget == For info..." wikitext text/x-wiki <noinclude> This widget allows you to add a [https://developers.google.com/youtube/player_parameters YouTube video player] to your wiki page. == Using this widget == For information on how to use this widget, see the [http://www.mediawikiwidgets.org/YouTube widget description page on MediaWikiWidgets.org]. == Copy to your site == To use this widget on your site, just install the [http://www.mediawiki.org/wiki/Extension:Widgets MediaWiki Widgets extension] and the copy [{{fullurl:{{FULLPAGENAME}}|action=edit}} full source code] of this page to your wiki, as an article called '''{{FULLPAGENAME}}'''. </noinclude><includeonly><iframe width="<!--{$width|escape:'html'|default:'425'}-->" height="<!--{$height|escape:'html'|default:355}-->" src="https://www.youtube.com/embed/<!--{if isset($playlist)}-->?listType=playlist&list=<!--{$playlist|escape:'urlpathinfo'}--><!--{else}--><!--{$id|escape:'urlpathinfo'}--><!--{/if}-->" frameborder="0" allowfullscreen></iframe></includeonly> 0f25e421a22b9653f19734c8ae276b73f45a8c90 User:Reg 2 15 34 33 2014-12-11T21:36:52Z Reg 2 wikitext text/x-wiki Adam Sawicki<br> Homepage/blog: http://asawicki.info/ 6c0ec3871cd981e759b4dbcb589b571580b1e252 33 2014-12-11T21:36:36Z Reg 2 Created page with "Adam Sawicki Homepage/blog: http://asawicki.info/" wikitext text/x-wiki Adam Sawicki Homepage/blog: http://asawicki.info/ e64f422e7bec295d4f325709cb49e3886ae29bfd KK's Wiki:About 4 7 14 2014-12-11T09:53:35Z Krzysiek 1 Created page with "This is place where I intend to accumulate some documentation about my projects, hopefully with help from all of you. If you'd like to contribute, create account on this Wiki..." wikitext text/x-wiki This is place where I intend to accumulate some documentation about my projects, hopefully with help from all of you. If you'd like to contribute, create account on this Wiki and drop me an email with your user name to get write permissions. This is only to prevent bots from messing with the pages. I don't bite, so don't hesitate to contact me. :) 3265743f1fe7d07905b3d288c0641333ef80284b KK's Wiki:General disclaimer 4 6 13 12 2014-12-11T09:51:06Z Krzysiek 1 wikitext text/x-wiki #include <stddisclaimer> No responsibility taken for any use of the contents of this Wiki or this Site. No warranties and so on... Have fun, but don't kill yourself. :) 6d5656c0fef3c2f116515a216bf959f890450e4c 12 2014-12-11T09:50:47Z Krzysiek 1 Created page with "#include <stddisclaimer> No responsibility taken for any use of the contents of this Wiki or this Site. No warranties and so on... Have fun, but don't kill yourself. :)" wikitext text/x-wiki #include <stddisclaimer> No responsibility taken for any use of the contents of this Wiki or this Site. No warranties and so on... Have fun, but don't kill yourself. :) cc4835ea71dc7ba95dd8524f732a9416093f8ba5 KK's Wiki:Privacy policy 4 5 11 2014-12-11T09:48:55Z Krzysiek 1 Created page with "This Privacy Policy governs the manner in which Krzysztof Kluczek and DevKK.net collects, uses, maintains and discloses information collected from users (each, a "User") of th..." wikitext text/x-wiki This Privacy Policy governs the manner in which Krzysztof Kluczek and DevKK.net collects, uses, maintains and discloses information collected from users (each, a "User") of the http://www.devkk.net/ website ("Site"). This privacy policy applies to the Site and all products and services offered by Krzysztof Kluczek and DevKK.net. '''Personal identification information''' We may collect personal identification information from Users in a variety of ways, including, but not limited to, when Users visit our site, register on the site, place an order, subscribe to the newsletter, respond to a survey, fill out a form, and in connection with other activities, services, features or resources we make available on our Site. Users may be asked for, as appropriate, name, email address. Users may, however, visit our Site anonymously. We will collect personal identification information from Users only if they voluntarily submit such information to us. Users can always refuse to supply personally identification information, except that it may prevent them from engaging in certain Site related activities. '''Non-personal identification information''' We may collect non-personal identification information about Users whenever they interact with our Site. Non-personal identification information may include the browser name, the type of computer and technical information about Users means of connection to our Site, such as the operating system and the Internet service providers utilized and other similar information. '''Web browser cookies''' Our Site may use "cookies" to enhance User experience. User's web browser places cookies on their hard drive for record-keeping purposes and sometimes to track information about them. User may choose to set their web browser to refuse cookies, or to alert you when cookies are being sent. If they do so, note that some parts of the Site may not function properly. '''How we use collected information''' DevKK.net may collect and use Users personal information for the following purposes: - To improve customer service Information you provide helps us respond to your customer service requests and support needs more efficiently. - To personalize user experience We may use information in the aggregate to understand how our Users as a group use the services and resources provided on our Site. - To improve our Site We may use feedback you provide to improve our products and services. - To process payments We may use the information Users provide about themselves when placing an order only to provide service to that order. We do not share this information with outside parties except to the extent necessary to provide the service. - To run a promotion, contest, survey or other Site feature To send Users information they agreed to receive about topics we think will be of interest to them. - To send periodic emails We may use the email address to send User information and updates pertaining to their order. It may also be used to respond to their inquiries, questions, and/or other requests. If User decides to opt-in to our mailing list, they will receive emails that may include company news, updates, related product or service information, etc. If at any time the User would like to unsubscribe from receiving future emails, we include detailed unsubscribe instructions at the bottom of each email or User may contact us via our Site. '''How we protect your information''' We adopt appropriate data collection, storage and processing practices and security measures to protect against unauthorized access, alteration, disclosure or destruction of your personal information, username, password, transaction information and data stored on our Site. '''Sharing your personal information''' We do not sell, trade, or rent Users personal identification information to others. We may share generic aggregated demographic information not linked to any personal identification information regarding visitors and users with our business partners, trusted affiliates and advertisers for the purposes outlined above. '''Third party websites''' Users may find advertising or other content on our Site that link to the sites and services of our partners, suppliers, advertisers, sponsors, licensors and other third parties. We do not control the content or links that appear on these sites and are not responsible for the practices employed by websites linked to or from our Site. In addition, these sites or services, including their content and links, may be constantly changing. These sites and services may have their own privacy policies and customer service policies. Browsing and interaction on any other website, including websites which have a link to our Site, is subject to that website's own terms and policies. '''Changes to this privacy policy''' DevKK.net has the discretion to update this privacy policy at any time. When we do, we will post a notification on the main page of our Site, revise the updated date at the bottom of this page. We encourage Users to frequently check this page for any changes to stay informed about how we are helping to protect the personal information we collect. You acknowledge and agree that it is your responsibility to review this privacy policy periodically and become aware of modifications. '''Your acceptance of these terms''' By using this Site, you signify your acceptance of this policy. If you do not agree to this policy, please do not use our Site. Your continued use of the Site following the posting of changes to this policy will be deemed your acceptance of those changes. '''Contacting us''' If you have any questions about this Privacy Policy, the practices of this site, or your dealings with this site, please contact us at: DevKK.net http://www.devkk.net/ privacy [at] devkk.net ca9e3ab5ea769c241bf375bb66fe51edf179060d File:DB2 Dread game config box.png 6 26 134 2021-09-06T21:21:44Z Krzysiek 1 Doom Builder 2 showing Dread game configuration. wikitext text/x-wiki Doom Builder 2 showing Dread game configuration. f8fd5b56fc8de607981157d4ef4e8ea1ffb390f0 File:DB2 new map.png 6 27 138 2021-09-07T19:27:02Z Krzysiek 1 wikitext text/x-wiki da39a3ee5e6b4b0d3255bfef95601890afd80709 Category:K65 14 16 71 36 2014-12-21T12:35:08Z Krzysiek 1 wikitext text/x-wiki Pages in this category relate to '''[[K65]]''' compiler. 068bff9db553225d03e685e137693278b2eff2c1 36 2014-12-15T22:08:30Z Krzysiek 1 Created blank page wikitext text/x-wiki da39a3ee5e6b4b0d3255bfef95601890afd80709